Template talk:Prime
(Redirected from Template talk:′)
Latest comment: 1 year ago by Beland in topic Proposed revision, copied from deletion discussion
This is the talk page for discussing improvements to the Prime template. |
|
This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
This template was considered for deletion on 2016 November 7. The result of the discussion was "keep". |
Template:Prime is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here. |
Proposed revision, copied from deletion discussion
editThe original can be found at Wikipedia:Templates for discussion/Log/2016 November 7#Template:′, but is copied here for reference, as it's now being wored on. 71.41.210.146 (talk) 16:00, 17 November 2016 (UTC)
- Keep per above. I'm wondering if it won't be neater to have the template accept an argument, for example {{prime|f}} for f′. That way the spacing could be adjusted according to the preceding character. – Uanfala (talk) 20:13, 8 November 2016 (UTC)
- @Uanfala: H'mm... that's more ambitious than I was planning (I was considering allowing an explicit spacing specification), but not a horrible idea. Since the number of possible spacings is small (characters are go into groups which share the spacing), I could take the last character with
{{#invoke:String|pos|argument|-1}}
, and then look it up in an if-chain with{{#invoke:String|find|abcde|letter}}
. We could at least cover the standard Latin and Greek alphabets. - The big problem is that the correct spacing is font-dependent, and I don't know the user's display fonts, so it's all a guess. But I don't think a rough guess is making it worse. (I spent a while playing with Unicode zero-width characters to see if there existed one that would get the kerning right, but no joy.)
- So I'm thinking the following:
{{prime|prefix|as-if|sp=0.1em}}
The prefix parameter{{{1}}}
is displayed, but the spacing is derived from the as-if parameter{{{2}}}
, which defaults to the last character of the prefix, but may be given separately if trailing markup in the prefix would confuse things. (Doing it this way allows a double pipe{{prime|as-if}}
to compactly ask for no displayed prefix.){{{sp}}}
gives an explicit spacing that overrides all of the preceding. - I'd do it with one sub-template: a
{{′/calc_space|as-if}}
which does the computation and returns the spacing. The parent template would invoke it if{{{sp}}}
isn't given...{{{1|}}}<span class="nowrap" style="padding-left:{{{sp|{{′/calc_space|{{{2|{{#invoke:String|pos|{{{1|f}}}|-1}}}}}}}}}};">′</span>
The default to 'f' provides maximum space if unspecified. - Does that seem like a reasonable plan? 71.41.210.146 (talk) 11:48, 9 November 2016 (UTC)
- Second thoughts: Probably the calculation template should not be here, but a sub-template of Template:italics correction. Maybe Template:Italics correction/calc? Then both templates can use it. 71.41.210.146 (talk) 12:04, 9 November 2016 (UTC)
- I have almost no knowledge of typography so I'm afraid I won't be of much use. But yes, that sounds like a good idea. – Uanfala (talk) 14:36, 9 November 2016 (UTC)
- @Uanfala: It wasn't the typography I was asking about, but the Wikipedia template design & implementation. Are those good parameters? Does that seem like a reasonably efficient implementation? And should I start work now, or wait for this TfD wraps up? 71.41.210.146 (talk) 16:02, 9 November 2016 (UTC)
- I don't know much about templates either, but the parameters look usable enough, and it's sensible to have the calculation done in one place where it can be used by multiple templates. As for efficiency, if you have experience of lua, it'll be better to do it with a module. If not, it's OK – I don't think computational efficiency should be much of an issue. – Uanfala (talk) 16:10, 9 November 2016 (UTC)
- @Uanfala: It wasn't the typography I was asking about, but the Wikipedia template design & implementation. Are those good parameters? Does that seem like a reasonably efficient implementation? And should I start work now, or wait for this TfD wraps up? 71.41.210.146 (talk) 16:02, 9 November 2016 (UTC)
- I have almost no knowledge of typography so I'm afraid I won't be of much use. But yes, that sounds like a good idea. – Uanfala (talk) 14:36, 9 November 2016 (UTC)
- @Uanfala: H'mm... that's more ambitious than I was planning (I was considering allowing an explicit spacing specification), but not a horrible idea. Since the number of possible spacings is small (characters are go into groups which share the spacing), I could take the last character with
(FTR, this has since been implemented. -- Beland (talk) 19:17, 3 February 2023 (UTC))