Return to User:Yaulendil/Template ideas.
See also User:Yaulendil/Timeline ideas.
Cyan text concerns possible changes to Tolkien Gateway beyond this hypothetical template.
Rpex
Key
<ref>{{User:Yaulendil/Template/Rp expanded|}}</ref>
...But maybe it should be:
<ref>{{rpex|}}</ref>
Purpose and goals
I held off on continuing my edits to the Timeline pages because I thought my use of Template:Rp was making it too cluttered and unreadable. One solution would have been to only use {{rp}} for page and paragraph numbers, but I didn't like having to sacrifice the specificity of particular notes, paragraph commentaries, and descriptions by doing that. For example, this[1]:Note on §85, p. 106 could become this,[1]:106 but at the loss of a pointer to the exact place on the page. In the long run that's a perfectly appropriate sacrifice to make, but I wondered if I could have my cake and eat it too. (To skip ahead, like this:[1]:106Page 106
Commentary on §85
MouseOver the underlined part.)
This coincided with a few other problems:
- I didn't want to type up the § symbol each time I cited a paragraph number in the Annals instead of a page. (Nor click on it in the special characters window.)
- Sometimes I felt the need to include a brief quote within a reference,[note 1] which meant I couldn't just bundle it under a more general reference and point to a page number with
{{rp}}, not even if I'd had a pre-1992 edition of Unfinished Tales. {{rp}}would not work well with{{Cite DTP}}identifiers.
Wikipedia inspired possible solutions. Their Template:Reference page is more expansive than Tolkien Gateway's, allowing you to specify if you're using one or multiple pages, an in-source-location not within any numbered page, and if you are including a quote, hiding that quote (and its translation) within a tooltip window that appears when you hover over the page number.
That motivated me to make this template page. My goal was more "ambitious"[note 2] than just duplicating Wikipedia's version. While Wikipedia's used the tooltip exclusively for quotes and their translations, I wanted to use it for the specifics like paragraph number. (Example.)[1]:106Page 106
Commentary on §85
Also:
- I wanted to be able to cite by paragraphs instead of pages, since that was the standard set by the
{{AA}}and{{GA}}templates, and automatically include § symbols just by using the right parameter. I wanted to be able to specify that paragraph numbers should appear in the superscript and pages in the tooltip window, even if parameters for both are called.[note 3] - I wanted to be able to cite by lines of verse instead of pages or paragraph numbers, which potentially seemed useful if citing a particular lay from The Lays of Beleriand, even though I've never seen anyone do that on TG and page numbers seem a better way to do it since (I think) no versions of The Lays of Beleriand differ by page number.
- Example with just lines.[2]:1164–6 Example with details.[3]:1164–6Page 193
Lines 1164–6
Verse location: The Lay of Leithian, Canto IV
Example with details and page number as the visible.[3]:193Page 193
Lines 1164–6
Verse location: The Lay of Leithian, Canto IV
- Note: Is
{{LB}}broken when not specifying a part or chapter?
- Note: Is
- Example with just lines.[2]:1164–6 Example with details.[3]:1164–6Page 193
- I wanted to be able to cite by DTP identifiers.
My goal was a Swiss Army knife. Which I understand is probably a bad idea from the start, going against a keep-it-simple-stupid principle, even if I did understand programming fundamentals. I think what I've made is what they call spaghetti code. But it at least seems to work as intended. I haven't seen it outright fail any test case, but I haven't tested all possible variations of using it.
I'm wondering if I could move it from this User subpage into an actual template page, perhaps as Template:Rpex. Or even into Template:Rp since, if only the default parameter is used, mine should output the same as what the original did, and I think not even process the rest of the complicated code.[note 4]
I would need someone who has a technical understanding to at least look over my code above and make sure it won't somehow crash the site, create page-loading issues, mobile browser compatibility issues, stuff like that. It's probably very needlessly inefficient, and there might be ways it could mess up that I haven't considered.[note 5][note 6][note 7][note 8]
If it passes a basic safety test, I could go ahead and use it until someone (even myself) has the time to make a proper version of it. In the meantime it could work as a makeshift, particularly for my edits to the Timeline pages, so long as when this template is improved it gives basically the same outputs.
Biggest non-technical objection to using it would probably just be that it's too idiosyncratic, too ad hoc. There's probably no wiki where an underlined tooltip like that of Template:Reference page is used to contain information besides quote and translation stuff. There's probably a general wiki-editing principle against using a system that you'd never see across a bunch of other wikis.
If even using it as a makeshift is too objectionable, oh well, I had some fun with it. And maybe individual ideas will be useful even though the whole thing doesn't have a narrow-enough scope.
See also #Alternative: Sub-referencing.
Description of the code
(I only just realize that the nowiki tags are active in <pre> boxes. I'll think about how best to display this later, if anyone wants to really review this I guess you'll have to look at the page source.)
First:
<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">
Using the same style as the original template, which wasn't normal superscript. (I think an edit summary mentioned something about making it work with "Citizen"?)
Then:
{{#if:{{{1|}}}|:{{{1|}}}
Seeing if the default parameter was used, as should be the case for all preexisting uses of {{rp}}. If it was, it outputs something identical to {{{rp}}}'s code. If not, all the rest of the code is in the negative branch of this if statement.
Note the difference with the original code:
{{#ifeq:{{{1}}}|brackets|({{{2|}}})|:{{{1|}}}}}
I didn't understand what it means to compare the default parameter to "brackets", if that's literally just the string "brackets" or what, and I didn't understand what {{{2|}}} was, so I started from scratch. That will have to be changed back if "brackets" and {{{2|}}} were critical.
Next, it decides whether to prepend a colon:
|{{#if:{{{dtp-end|}}}|{{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{q|}}}{{{qp|}}}{{{qpp|}}}{{{lang|}}}{{{t|}}}{{{tp|}}}{{{tpp|}}}{{{t-source|}}}{{{p-with-p|}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}|{{{dtp-end|}}}||{{#if:{{{base-select|}}}|{{#switch:{{{base-select|}}}|dtp-end=|=|#default=:}}}}|:}}|:}}
Alternate option, if everything including dtp-end gets a colon:
|:
This was the most nightmarish part. The goal was to "predict" whether or not either of parameters dtp-end or dtp-full will be the visible part rather than hidden in the tooltip. If a full or partial DTP identifier was the visible part, no colon was prepended, otherwise a colon was prepended.
Now though, a colon is only withheld if dtp-end is the visible part. dtp-full gets a colon like everything else.
It's difficult because there are multiple scenarios which would cause dtp-full to be visible. Honestly, I wasn't entirely sure what I was thinking, sort of trial-and-erroring it, and stopped when my test cases gave me what I wanted.
It's a lot of writing just to satisfy an aesthetic preference. I think this[4]:.04.024 looks bad and this[4].04.024 looks good.[note 9]
But maybe it would be more consistent to keep the colon in all cases, on top of reducing the size of the code.
Following Wikipedia's example, I also want the dashed underline to not appear under the colon, so like this[1]:§113 instead of like this.[1]:§113 That places some limits on introducing colons in more specific cases deeper within the nested statements, within the tooltips.
The rest of the code is all under a single switch statement, which begins:
{{#switch:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{q|}}}{{{qp|}}}{{{qpp|}}}{{{lang|}}}{{{t|}}}{{{tp|}}}{{{tpp|}}}{{{t-source|}}}{{{p-with-p|}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}|{{{p|}}}={{{p|}}}|{{{pp|}}}={{{pp|}}}|{{{para|}}}=§{{{para|}}}|{{{paras|}}}=§§{{{paras|}}}|{{{loc|}}}={{{loc|}}}|{{{loc-long|}}}={{{loc-long|}}}|{{{note|}}}=n.{{{note|}}}|{{{comment|}}}=<span style="border-bottom:1px dashed">{{tooltip|cmt.|Commentary on}}</span>§{{{comment|}}}|{{{comments|}}}=<span style="border-bottom:1px dashed">{{tooltip|cmt.|Commentary on}}</span>§§{{{comments|}}}|{{{chapter-num|}}}=Ch.{{{chapter-num|}}}|{{{chapter|}}}="{{{chapter|}}}"|{{{subchapter|}}}="{{{subchapter|}}}"|{{{dtp-end|}}}={{{dtp-end|}}}|{{{dtp-full|}}}={{{dtp-full|}}}|{{{line|}}}={{{line|}}}|{{{lines|}}}={{{lines|}}}|{{{line-loc|}}}={{{line-loc|}}}|{{{q|}}}=<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|{{{qp|}}}={{{qp|}}}|{{{qpp|}}}={{{qpp|}}}|{{{lang|}}}=[{{{lang|}}}]|{{{t|}}}=<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|{{{tp|}}}={{{tp|}}}|{{{tpp|}}}={{{tpp|}}}|{{{t-source|}}}={{{t-source|}}}|{{{p-with-p|}}}=p.{{{p-with-p|}}}|{{{pp-with-pp|}}}=pp.{{{pp-with-pp|}}}|{{{line-with-l|}}}=<span style="border-bottom:1px dashed">{{tooltip|l.|Line}}</span>{{{line-with-l|}}}|{{{lines-with-ll|}}}=<span style="border-bottom:1px dashed">{{tooltip|ll.|Lines}}</span>{{{lines-with-ll}}}|{{{base-select|}}}={{rpex}} error
This is that switch statement before the #default branch. It takes in a bunch of parameters and then goes through all the cases in which only 1 parameter was used, outputting the result without a tooltip window and without a dashed underline.
Except in the case of {{{q}}} and {{{t}}}, because those cases are too long to not hide within a tooltip. If for some reason an editor does use this template for just {{{q}}} or {{{t}}}, the results look like this[5]:quoteQuotation: "Ahogy az erdőre hív, úgy visít vissza." and this.[5]:translationTranslation: "As you call into the forest, so it echoes back."
(I don't actually know which of the parameters need to be tested against the singular cases, eventually I just put all of them that I could think of in. Yeah, all 30 are there.)
If more than one of these parameters are used, we go to the default case...
|#default=<span style="border-bottom:1px dashed">{{tooltip
...that creates a dashed underline and introduces a tooltip:
|{{#switch:{{{base-select|}}}|p={{{p|}}}|pp={{{pp|}}}|para=§{{{para|}}}|paras=§§{{{paras|}}}|loc={{{loc|}}}|note=Note {{{note|}}}|comment=cmt.§{{{comment|}}}|comments=cmt.§§{{{comments|}}}|chapter-num=Ch.{{{chapter-num|}}}|chapter="{{{chapter|}}}"|subchapter="{{{subchapter|}}}"|dtp-end={{{dtp-end|}}}|dtp-full={{{dtp-full}}}|line={{{line|}}}|lines={{{lines|}}}|line-loc={{{line-loc|}}}|qp={{{qp|}}}|qpp={{{qpp|}}}|tp={{{tp|}}}|tpp={{{tpp|}}}|t-source={{{t-source|}}}|p-with-p=p.{{{p-with-p|}}}|pp-with-pp=pp.{{{pp-with-pp|}}}|line-with-l=l.{{{line-with-l|}}}|lines-with-ll=ll.{{{lines-with-ll|}}}|loc-long={{{loc-long|}}}|q=quote|t=translation|lang=[{{{lang|}}}]
The visible part of the tooltip is determined by a switch statement, which first determines the contents of the {{{base-select}}} parameter. This parameter is for cases like where you've included the page number(s) as a parameter but still want the paragraphs or lines to be the visible part, like when referencing the Annals or maybe when referencing poetry. You can also use base-select to specify that you want page numbers to be like :p.123 rather than :123.
The default case of this switch statement has a hierarchy or priority of parameters within nested if statements (15) to make the visible one if {{{base-select}}} wasn't called:
|base-select|#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p-with-p|}}}|p.{{{p-with-p|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp-with-pp|}}}|pp.{{{pp-with-pp|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{line-with-l|}}}|l.{{{line-with-l|}}}|{{#if:{{{line|}}}|{{{l|}}}|{{#if:{{{lines-with-ll|}}}|ll.{{{lines-with-ll|}}}|{{#if:{{{ll|}}}|{{{ll|}}}|{{#if:{{{note|}}}|n.{{{note|}}}|{{#if:{{{comment|}}}|cmt.{{{comment|}}}|{{#if:{{{comments|}}}|cmt.{{{comments|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{rpex}} error}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
(The last of these was note to loc to chapter-num to dtp-full, now it's note to comment to comments to loc.)
Alternate, 21 levels of nested if statements; I think it doesn't work and levels 16–21 are ignored:
|loc-long|q|t|lang|base-select|#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p-with-p|}}}|p.{{{p-with-p|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp-with-pp|}}}|pp.{{{pp-with-pp|}}}|{{#if:{{{pp|}}}|pp.{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{line-with-l|}}}|l.{{{line-with-l|}}}|{{#if:{{{line|}}}|{{{line|}}}|{{#if:{{{lines-with-ll|}}}|ll.{{{lines-with-ll|}}}|{{#if:{{{lines|}}}|{{{lines|}}}|{{#if:{{{note|}}}|n.{{{note|}}}|{{#if:{{{comment|}}}|comm.§{{{comment|}}}|{{#if:{{{comments|}}}|comm.§§{{{comments|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{#if:{{{qp|}}}|{{#if:{{{qpp|}}}|{{#if:{{{subchapter|}}}|"{{{subchapter|}}}"|{{#if:{{{chapter-num|}}}|Ch.{{{chapter-num}}}|{{#if:{{{chapter|}}}|"{{{chapter|}}}"|{{#if:{{{dtp-full|}}}|{{{dtp-full}}}|{{rpex}} error}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
Another alternate, 6 levels of nested if statements:
|loc-long|q|t|lang|base-select|#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{rpex}} error}}}}}}}}}}}}}}
(I'm not sure if the alternate versions have the right numbers of end-brackets to be replaced into the rest of the code properly.)
Originally I had 13 nested if statements. 17 if we're counting anything nested within anything. I thought about changing it to a switch statement, since once it finds a first matching case/branch it stops, and I thought I could just order the branches in this hierarchy, but I didn't see a way to do that. I don't know how to test if there's any occurrence of the parameter rather than if it's the only occurring parameter out of the possible ones before the cases and branches; if cases/branches of a switch statement could determine if there is any occurrence of a parameter rather than only an occurrence of a parameter out of all the parameters tested.
I ended up with 15 nested ifs, so I guess 19 nested anythings. 15 seems to be the limit based on testing around with it.
Another solution I'm thinking of, represented by the 6-if-statement alternative, is to remove most of the nested if statements from this "default" base-choosing, so that maybe only dtp-end, p, pp, para, paras, and loc are possible "default" bases (I could maybe fit in one more for a 7th), and if none of those are present you get a "failure mode" of a red dashed-underlined tooltip saying {{{rpex}}} error.[note 10]
And if you want anything besides those 6 or 7 parameters to be the visible base, you have to resort to base-select, as in the case of the current version for anything besides the 15 possible parameters. You can make as many cases for base-select's switch statement as you want, including chapter and subchapter, and if we only ever use chapter consciously, you could expect the editor to only use it if the chapter is in number form only (or make two separate parameters, chapter-number and chapter, and chapter-number is output into the visible base like :Ch.14).
Originally I thought the longer switch statement could also have multiple options for the same chosen parameter. Like |base-select=p could output :123 while |base-select=p-with-p could output :p.123 or maybe :p123. But instead I made p-with-p and similar things their own parameters outright.
And now the second parameter in the tooltip is filled out...
|{{#if:{{{chapter|}}}|Chapter{{#if:{{{chapter-num|}}}| {{{chapter-num|}}}}}: "{{{chapter|}}}"<br>|{{#if:{{{chapter-num|}}}|Chapter {{{chapter-num|}}}<br>}}}}{{#if:{{{subchapter|}}}|Subchapter: "{{{subchapter|}}}"<br>}}{{#if:{{{p-with-p|}}}|Page {{{p-with-p|}}}<br>|{{#if:{{{p|}}}|Page {{{p|}}}<br>}}}}{{#if:{{{pp-with-pp|}}}|Pages {{{pp-with-pp|}}}<br>|{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>}}}}{{#if:{{{para|}}}|§{{{para|}}}<br>}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>}}{{#if:{{{note|}}}|Note {{{note|}}}<br>}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>}}{{#if:{{{line-with-l|}}}|Line {{{line-with-l|}}}<br>|{{#if:{{{line|}}}|Line {{{line|}}}<br>}}}}{{#if:{{{lines-with-ll|}}}|Lines {{{lines-with-ll|}}}<br>|{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>}}}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>}}{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}{{#if:{{{q|}}}|Quotation{{#if:{{{qp|}}}| from p. {{{qp|}}}}}{{#if:{{{qpp|}}}| from pp. {{{qpp|}}}}}: "{{{q|}}}"{{#if:{{{lang|}}}| [{{{lang|}}}]}}<br>}}{{#if:{{{t|}}}|Translation{{#if:{{{tp|}}}| from p. {{{tp|}}}}}{{#if:{{{tpp|}}}| from pp. {{{tpp|}}}}}{{#if:{{{t-source|}}}| ({{{t-source|}}})}}: "{{{t|}}}"<br>}}{{#if:{{{dtp-full|}}}|DTP identifier: {{{dtp-full|}}}}}
...which will always be the same whenever a tooltip is used (except in the unique cases of {{{q}}} and {{{t}}} mentioned earlier). Using if statements it just shows whatever parameters were provided in a certain order.
If both
p and p-with-p are provided, p overrides p-with-p:
Never mind, I reversed it:
{{#if:{{{p-with-p|}}}|Page {{{p-with-p|}}}<br>|{{#if:{{{p|}}}|Page {{{p|}}}<br>}}}}{{#if:{{{pp-with-pp|}}}|Pages {{{pp-with-pp|}}}<br>|{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>}}}}
This is not the case with p and pp. Those will both be shown the former above the latter.
Likewise with line and line-with-l:
{{#if:{{{line-with-l|}}}|Line {{{line-with-l|}}}<br>|{{#if:{{{line|}}}|Line {{{line|}}}<br>}}}}{{#if:{{{lines-with-ll|}}}|Lines {{{lines-with-ll|}}}<br>|{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>}}}}
chapter-num and chapter interact in a complicated way depending on whether or not both are provided:
{{#if:{{{chapter|}}}|Chapter{{#if:{{{chapter-num|}}}| {{{chapter-num|}}}}}: "{{{chapter|}}}"<br>|{{#if:{{{chapter-num|}}}|Chapter {{{chapter-num|}}}<br>}}}}
(Earlier I had the chapter and subchapter between the verse location and the in-source-location. I think placing them above the page(s) and so on might be less random. Ideally the page(s) would always be at the top of the tooltip window, but in most cases chapter and subchapter names won't be included, so they will be.)
A tricky part here was {{{loc}}} and {{{loc-long}}}. There could be cases where the editor is referencing something that can only be specified by location, which needs to be brief as visible but the tooltip can describe this location more specifically. So when both {{{loc}}} and {{{loc-long}}} are used the short {{{loc}}} drops out from what's expressed in the tooltip window.
Here's a closeup of that section:
{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}
The parts with q and t and their associated parameters also interact:
{{#if:{{{q|}}}|Quotation{{#if:{{{qp|}}}| from p. {{{qp|}}}}}{{#if:{{{qpp|}}}| from pp. {{{qpp|}}}}}: "{{{q|}}}"{{#if:{{{lang|}}}| ({{{lang|}}})}}<br>}}{{#if:{{{t|}}}|Translation{{#if:{{{tp|}}}| from p. {{{tp|}}}}}{{#if:{{{tpp|}}}| from pp. {{{tpp|}}}}}{{#if:{{{t-source|}}}| ({{{t-source|}}})}}: "{{{t|}}}"<br>}}
An example with everything filled out, and using base-select on pp: Example.[6]:1233–5Chapter 9: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 2345
Pages 2344–6
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 890
Lines 890–905
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322 (Howard Green's editorial note): "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
The code of the above: {{User:Yaulendil/Template/Rp expanded|p=1234|p-with-p=2345|pp=1233–5|pp-with-pp=2344–6|para=321|paras=311–31|line=789|line-with-l=890|lines=789–95|lines-with-ll=890–905|line-loc="Ode to a Morain"|note=15|comment=15|comments=1–150|loc=Braille footnote|loc-long=Braille footnote running diagonally from lower-left corner of page|chapter-num=9|chapter=Gelasian Spring|subchapter=The Lays of the Gelasian|dtp-end=.12.144|dtp-full=DRP SE.09.12.144|q=<i>Hallottam, amint a barátom követ köszörül az arête túloldalán.</i>|lang=hu|t=I heard my friend grinding stone on the other side of the arête.|qp=1235|qpp=1234–35|tp=4321|tpp=4320–4322|t-source=Howard Green's editorial note|base-select=pp}}
Without the {{{base-select}}}: Example.[6].12.144Chapter 9: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 2345
Pages 2344–6
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 890
Lines 890–905
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322 (Howard Green's editorial note): "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
Compare with dtp-end absent and no base-select (to show that if "p." or "pp." and the letterless pages are both included, the "p."/"pp." overrules both in the visible and in the tooltip window): Example.[6]:p.2345Chapter 9: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 2345
Pages 2344–6
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 890
Lines 890–905
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322 (Howard Green's editorial note): "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
Or with base-select=pp-with-pp: Example.[6]:pp.2344–6Chapter 9: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 2345
Pages 2344–6
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 890
Lines 890–905
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322 (Howard Green's editorial note): "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
Realistically, no editor would cite paragraph(s), note(s), and comment(s) at the same time. Maybe a few brief lines of verse could be in a paragraph, note or commentary. So realistically the biggest tooltip window would look like: Example.[6]:1234Chapter 9: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 2345
§321
Lines 890–905
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322 (Howard Green's editorial note): "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
Code of the above: {{User:Yaulendil/Template/Rp expanded|p=1234|p-with-p=2345|para=321|lines=789–95|lines-with-ll=890–905|line-loc="Ode to a Morain"|loc=Braille footnote|loc-long=Braille footnote running diagonally from lower-left corner of page|chapter-num=9|chapter=Gelasian Spring|subchapter=The Lays of the Gelasian|dtp-end=.12.144|dtp-full=DRP SE.09.12.144|q=<i>Hallottam, amint a barátom követ köszörül az arête túloldalán.</i>|lang=hu|t=I heard my friend grinding stone on the other side of the arête.|qp=1235|qpp=1234–35|tp=4321|tpp=4320–4322|t-source=Howard Green's editorial note|base-select=p}}
(Note to self: I wonder what Wikipedia does if you include both p and pp?)
}}</span>}}}}</sup>
Closing the dashed underline of the tooltip, the switch statement of everything after the possible colon, the if statement that included the default parameter, and the superscript of the whole template.
How to use
Example where only one parameter is used:
:{{{whichever parameter is chosen}}}
- Parameters that return values when used alone (recommended):
pppparaparaslocdtp-end
- Parameters that return values when used alone (less recommended):
notecommentcommentslinelinesp-with-ppp-with-ppline-with-llines-with-llchapter-num
- Parameters that return values when used alone (not recommended):
line-locchaptersubchapterdtp-fullqpqpptptppt-sourceloc-longqtlang
- Parameters that return no values when used alone:
base-select
Example where multiple parameters are used (hover over to see the tooltip window):
:{{{whichever parameter is chosen, either leaving it to the hierarchy or using {{{base select}}}}}}Chapter {{{chapter-num}}}: "{{{chapter}}}"
Subchapter: "{{{subchapter}}}"
Page {{{p}}}
Pages {{{pp}}}
§{{{para}}}
§§{{{paras}}}
Note {{{note}}}
Commentary on §{{{comment}}}
Commentary on §§{{{comments}}}
Line {{{line}}}
Lines {{{lines}}}
Verse location: {{{line-loc}}}
Location: {{{loc-long}}}
Quotation from p. {{{qp}}} from pp. {{{qpp}}}: "{{{q}}}" [{{{lang}}}]
Translation from p. {{{tp}}} from pp. {{{tpp}}} ({{{t-source}}}): "{{{t}}}"
DTP identifier: {{{dtp-full}}}
- Parameters that appear as the visible part if they are the first appearing in this order:
- 1.
dtp-end2.p3.p-with-p4.pp5.pp-with-pp6.para7.paras8.line9.line-with-l10.lines11.lines-with-ll12.note13.comment14.comments15.loc
- 1.
- Parameters that will never appear as the visible part unless called by
base-select:chapter-numdtp-fullqpqppline-locchaptersubchaptertptppt-sourceloc-longqtlang
- Parameters that will never appear as the visible part:
base-select
- Recommended parameters for the visible part:
dtp-endpppparaparasloc
- Less recommended parameters for the visible part:
notecommentcommentslinelinesp-with-ppp-with-ppline-with-llines-with-llchapter-numsubchapter
- Not recommended parameters for the visible part:
qpqpptptppdtp-fullchapterline-locloc-langqtlang
But in 99% of cases the tooltip window would only be for one or two extra lines of information.
Another version (not actually using this template, since it wouldn't show everything):
:
That's not working. Let's see if this works just to show what's in the tooltip.
| Each line will not appear if no parameter within it used. Chapter {{{chapter-num}}}: {{{chapter}}} ↑ {{{chapter-num}}} and space before it won't appear if not used; {{{chapter}}} and colon won't appear if not used. Subchapter: {{{subchapter}}} Page {{{p}}} ↑ Won't appear if {{{p-with-p}}} used. Page {{{p-with-p}}} Pages {{{pp}}} ↑ Won't appear if {{{pp-with-pp}}} used. Pages {{{pp-with-pp}}} §{{{para}}} §§{{{paras}}} Note {{{note}}} Commentary on §{{{comment}}} Commentary on §§{{{comments}}} Line {{{line}}} ↑ Won't appear if {{{line-with-l}}} used. Line {{{line-with-l}}} Lines {{{lines}}} ↑ Won't appear if {{{lines-with-ll}}} used. Lines {{{lines-with-ll}}} Verse location: {{{line-loc}}} Location: {{{loc}}} ↑ Won't appear if {{{loc-long}}} used. Location: {{{loc-long}}} Quotation from {{{qp}}} from {{{qpp}}}: "{{{q}}}" [{{{lang}}}] ↑ First " from " won't appear if {{{qp}}} not used, second " from " won't appear if {{{qpp}}} not used, space and brackets won't appear if {{{lang}}} not used. Translation from {{{tp}}} from {{{tpp}}} ({{{t-source}}}): "{{{t}}}" ↑ First " from " won't appear if {{{tp}}} not used, second " from " won't appear if {{{tpp}}} not used, space and parentheses won't appear if {{{t-source}}} not used. DTP identifier: {{{dtp-full}}} |
(A lot of the above[note 11] is not ideal. A lot of the recommendations are arbitrary. Also it's not a full showing of how the tooltip box is structured since some lines eclipse the others if they have parameters.)
(Also, in the hierarchy, I should remove
chapter-num and dtp-full and replace with comment and comments.)
Parameters
| Parameter | Parameter name | Description |
|---|---|---|
| Default | 1 |
The normal use of {{rp}} on TG. Normally used for page numbers or paragraphs, but could potentially be used for anything, and does not use a tooltip.If this default parameter is used, all named parameters will be ignored.
|
| Singular page number | p |
|
| Plural page numbers | pp |
|
| Singular paragraph | para |
The use of Template:AA and Template:GA imply that in many cases citing paragraph number(s) is preferable to citing page(s). This seems to be when the common reference is clearly defined and consists entirely or mainly of one long stretch of numbered paragraphs that do not restart or repeat.
|
| Plural paragraphs | paras |
|
| Note | note |
For the notes at the ends of sections, distinct from the commentaries that are listed by paragraph numbers. I have not included a plural notes parameter, thinking it would never make sense to use. The plural comments might not make sense to use either, but at least Christopher himself sometimes groups multiple paragraphs in one commentary note, such as §§1–3 on p. 58.
|
| Singular commentary | comment |
For the commentaries at the ends of sections, listed according to paragraph numbers applied to Tolkien's writings, distinct from the notes that are listed by number and usually before the commentaries. Note that Tolkien Gateway has referred to these as "Notes", as in {{AA|113|n}} J.R.R. Tolkien, Christopher Tolkien (ed.), Morgoth's Ring, "Part Two. The Annals of Aman": Note on §113. I think "Commentary on §113" is more accurate, the subsection heading is "Commentary on the fourth section of the Annals of Aman". (But even there, within this commentary subsection, there are two occurrences of {{AA|114|n}} J.R.R. Tolkien, Christopher Tolkien (ed.), Morgoth's Ring, "Part Two. The Annals of Aman": Note on §114, one on p. 105 and one on p. 106. That's another example of the kinds of things that made me make this template.) To keep things consistent with the citation templates as they are, this should be renamed to "Notes". But I think it would be better to change the citation templates to reflect my idea. Perhaps {{AA|4|c}} could give "Commentary on §4" while {{AA|4|n}} could give "Note 4", both being from "First section of the Annals of Aman".Possible abbreviations: "cmt.§8", "cmnt.§8", "comm.§8"; but I don't see a citation precedent for this, seems to come from internet forums.
|
| Plural commentary | comments |
|
| Singular line | line |
I'm inclined to think this would never be worth using in lieu of a page or DTP identifier. But if the common reference makes it clear that this is in a long poem, it could be easier to page through by line numbers (when labeled every five lines), then you don't have to waste a lot of time looking through the page once you've reached it. Also might be useful if the same poem shows up in multiple different texts. Downside is it might be very easy for readers to confuse with a page number, especially when there's no tooltip window with both.
|
| Plural lines | lines |
|
| Verse location | line-loc |
If the common reference is to a source with multiple poems or lays, this can specify which poem or lay (and which version; A or B, Lay of Leithian or Lay of Leithian Revisited) within that source the lines are from, without having to break the common reference into different common references for each poem or lay.
|
| Chapter number | chapter-num |
There should be opportunities to use both Arabic and Roman numerals, depending on the book.
|
| Chapter | chapter |
If chapter-num has also been provided, do not include the chapter number in chapter, especially for the sake of the tooltip window.
|
| Subchapter | subchapter |
Like loc, but for when the location is a specific section or subchapter, such as "Excursus on the languages of Beleriand".
|
| Location | loc |
I can see this used in a few different ways. One is in cases where the source cannot be found on any page, like "dust jacket", or describing something on a painting. The other is where it is on a page, or multiple pages, but doesn't have a specific name in a header, for example "Hador table II", a genealogical table.
|
| Location (long version) | loc-long |
In some cases loc might be the main specifier, visible, but a further specification or a longer, fuller version of the abbreviated location in loc can be desired in the tooltip window. In that case loc-long can contain the longer, fuller version.
|
| Quotation | q |
When including a brief quote from the reference. (Note: When I've seen this done on TG, the quote is usually italicized. In the tooltip window, I've intended to italicize foreign- or fictional-language quotes and not the translations. I suppose everything could be italicized, though. If the italicization wasn't for all cases, the italics formatters could exist within the code, and not require the editor to remember to include them. Requiring the editor to include them would also have the problem of leaving the quotation marks unitalicized, assuming I leave those in the code instead of giving the editor the choice to include them or not.)
|
| Singular quotation page | qp |
Only if the page(s) of the reference differ from the page(s) of the quote. (I'm guessing such a case would be if the reference is to many pages but the quote is only on one of them?) (Also, I wonder if on the Wikipedia version, the quotation page numbers just replace what would have been the page numbers on the tooltip window, instead of the tooltip window showing two sets of pages. Maybe the entire tooltip window is supposed to be solely for quote-specific stuff. I know it wasn't meant to be used as I use it, including a bunch of more specific information in it, generally.)
|
| Plural quotation pages | qpp |
|
| Language | lang |
If the quotation is in a foreign or fictional language, the language can be included in this parameter. As of now this is only for showing up within the tooltip window, and I don't even know how Wikipedia uses it in its version, I don't know if it shows up in their tooltip window, it doesn't provide an example of that. It's possible this is for back end stuff rather than the reader's use. Wikipedia also seems to intend the editor to use an abbreviation, like "de" for German. There is probably not a standard way to apply that to Tolkien's languages. Abbreviations seem to either be a single letter (Q.), two letters the first being superscript (MQ.), or three letters (Roh.). Occasionally you'll get a two-letter abbreviation (Ad.), but not intended for the same system that real-world languages like "hu" and "de" are in. These two-letter codes are from ISO 639. Obviously it would be silly trying to apply such a system to fictional languages. Wikipedia often puts these in brackets ([hu]), rather than parentheses ((hu)), and often uses them as links to articles in that language's Wikipedia. I'm not sure if common abbreviations for Tolkien's languages look decent in brackets rather than parentheses: [Q.], [Q], [MQ.], [MQ], [Roh.], [Roh]. Or more to the point, if scholars or websites ever place them in brackets.
|
| Translation | t |
If the quotation is in a foreign or fictional language, the translation can be included in this parameter.
|
| Singular translation page | tp |
Wikipedia's version doesn't have this, only qp and qpp, which is odd, because I'd expect a translation to be from outside the reference more than I'd expect the quote itself to be. I think this would be particularly true with Tolkien. Tolkien might write a passage in Elvish or Old English that Christopher translates on a distant page in a note or commentary.
|
| Plural translation pages | tpp |
|
| Translation source | t-source |
Describe a translation source if it's from elsewhere than pages in the same text. (Should this include editors providing their own translations...?)
|
| End of DTP identifier | dtp-end |
If the common reference is a leading portion of a DTP identifier, for example {{Cite DTP|LR 4}} LR 4Digital Tolkien Project Citation Systems, The Lord of the Rings, "The Two Towers", this template can supply different ending portions of that DTP identifier, for example .04.024 (for LR 4.04.024Digital Tolkien Project Citation Systems, The Lord of the Rings, "The Two Towers", "Of Herbs and Stewed Rabbit", Paragraph 24) and .05.025 (for LR 4.05.025Digital Tolkien Project Citation Systems, The Lord of the Rings, "The Two Towers", "The Window on the West", Paragraph 25).
|
| Full DTP identifier | dtp-full |
If you want to include the full DTP identifier. Unless dtp-full is the only parameter used (which is not recommended), this will appear at the bottom of the tooltip window.
|
| Base selector | base-select |
If multiple informational parameters are used, normally dtp-end will be visible (or "the base") over p and pp, and p and pp visible over para and paras, and para and paras visible over line and lines, the latter always being hidden within the tooltip window. But in some cases an editor might want to include the DTP identifier ending in the tooltip window while making the page number(s) visible, or include the page number(s) in the tooltip window while making the paragraph number(s) visible, the latter especially in the case of citing the Annals. Calling the name of the preferred parameter with base-select will overrule the hierarchy and make whichever is chosen visible, without losing the "dethroned" information in the tooltip window.
|
| Page number (with p.) | p-with-p |
According to an editor's individual judgement, they might want to include a "p." before the numbers so readers don't confuse pages for paragraphs (despite the § symbols) or pages for lines of verse (a lot easier to mix up than paragraphs).
|
| Page numbers (with pp.) | pp-with-pp |
|
| Line number (with l.) | line-with-l |
|
| Line numbers (with ll.) | lines-with-ll |
|
(I imagine most wiki editors would think there is no possible good justification for 24 named parameters. Even if most of them are never expected to be used. For one, maybe it just creates a too-much-information problem in the /Doc page that might scare off editors who otherwise would've used it well.)
(I spoke too soon. https://en.wikipedia.org/wiki/Template:Cite_book has 140 parameters.)
Full parameter set in horizontal format
{{rpex |p= |pp= |para= |paras = |loc= |loc-long = |note= |comment= |comments= |dtp-end= |dtp-full= |line= |lines= |line-loc= |chapter-num= |chapter= |subchapter= |q= |qp= |qpp= |lang= |t= |tp= |tpp= |t-source= |p-with-p= |pp-with-pp= |line-with-l= |lines-with-ll= |base-select=}}
That's 30.
Possible parameters to add
| Possible parameter | Possible parameter name | Description |
|---|---|---|
| Footnote | fn? |
Not much point if there's rarely more than one footnote per page? Just put "footnote" into loc maybe?
|
| Further location | loc-2 (I currently think of this as a likely alias for loc-long) |
For a further and distinct specification of loc that is not a longer version encompassing loc?
|
| Part number | part-num |
You would use this only when the parts are numbered in the book itself. The parts of War of the Jewels are Part 1, 2, 3, 4, and 5, but the Ainulindale in the published Silmarillion is not Part 1, the Valaquenta is not Part 2, the Quenta is not Part 3, the Akallabeth is not Part 4, The Rings of Power is not Part 5. There should be opportunities to use both Arabic and Roman numerals.
|
| Part | part |
Especially bad and pointless idea, I think. Well, imagine you had so many sources that you didn't want to make a separate ref for even the five different parts of The Silmarillion or Morgoth's Ring. Then you could use this along with chapter and subchapter and then the usual stuff like pages, or notes, or commentaries, or lines.
|
| DTP link | dtp-link |
If you wanted to include a link to the appropriate DTP page, and you couldn't just get dtp-full to get you there for whatever reason. (Or perhaps this could be a "yes" or "no" that turns adds or removes a hyperlink.)
|
Further to-do
Replace instances of "DTP reference" with "DTP identifier".(Done.) I don't know if that's DTP's own preferred language but it's the clear term on Template:Cite DTP/doc.Place the lettered versions of page(s) and line(s) higher up in their priorities, both in base and tooltip window.(Done.)- Figure out if there's a common term across wiki editing for what I call the "base" of the tooltip.
- Best I can tell, "the text", "text", "element", "component", maybe historically "icon".
- Set up a TemplateData thing to add aliases to parameter names.
- Add the ability to turn the DTP identifier endings into hyperlinks (or make that happen automatically). The same can be done for full DTP identifiers within the tooltip windows, as well or instead.
- There might be a general rule to not put external links in the main body of a page, reserving them for the References section, things like that. Especially since there's that external link symbol at the end of them, that's be weird in a superscript. Testing.[7]05.054 Hm, it works at least. But if not it would probably be okay to include in the tooltip. Testing.[7]05.054DTP identifier: H 05.054 With this template, just putting a link into
dtp-full.[7]05.054DTP identifier: H 05.054
- There might be a general rule to not put external links in the main body of a page, reserving them for the References section, things like that. Especially since there's that external link symbol at the end of them, that's be weird in a superscript. Testing.[7]05.054 Hm, it works at least. But if not it would probably be okay to include in the tooltip. Testing.[7]05.054DTP identifier: H 05.054 With this template, just putting a link into
- Consider whether dotted underline might not be more appropriate than dashed underline. (Template:Reference page uses dashed, but other Wikipedia things like Template:Abbr seem to prefer dotted for tooltips.
- Modify
{{tooltip}}so that the reader's cursor only turns into a pointing hand if the tooltip is also a clickable link (as with the reference shortcuts), and remains a caret cursor otherwise.- An arrow-cursor with a question mark might be even better than a caret. See what your cursor turns into with Template:Abbr on Wikipedia.
- Investigate whether it's possible to get the Edit Preview window to show tooltip windows. That works for ref shortcuts, but not for the Template:Tooltip that I use within this template.
- This works when the Edit Preview window is first loaded, but not when it's loaded after changing things during that edit session.
- Take a look at the tooltip that displays this note.[note 12] Notes, footnotes, aren't references, are they?
Other ideas
Add a thing before a colon before(Done.){{{subchapter}}}, like "Subchapter: ".Just add a(Done.)chapterparameter that is abovesubchapterin the tooltip window list and makeslocredundant if it was going to describe the chapter.- But a
partparameter would be too much.
- But a
Add(Done.) I guess the use of it would be if the whole ref is to a range of pages but this is to a quote on a specific page in that range? It can appear within the line thatqpandqpp.qdoes. LikeQuotation{{#if:{{{qp|}}}| on p. {{{qp|}}}|}}: "{{{q|}}}"{{#if:{{{lang|}}}| ({{{lang|}}})|}}<br>? Also provides a more natural place forlang, even though I still have no idea where Wikipedia puts its.- Apply something to automatically convert hyphens to en-dashes to separate page numbers, paragraph numbers, lines, etc., without affecting true hyphens like in "The Fall of Gil-galad".
- Apply something to automatically convert redundant ranges to non-redundant. For example 1848–1857 would automatically become :1848–57.
...It's a little odd that the Wikipedia template didn't mention anything about citing a source separately for a translation of a quote, or providing a page reference unique to the translation. You'd think that would be more useful than providing a separate page reference unique to the quotation. I could see for example a quote in Elvish on one page, then Christopher provides a translation in the notes on another page.(Added.)Should I think of a way to distinguish lines from pages? Since a text will have overlapping ranges of pages and lines and it may not be obvious if the reference is to a whole book or a particular poem with a sequence of lines. Prepend l. and ll.? Or line and lines? Without spaces in the visible superscript? I don't see many cases of l. and ll. being used or recommended. Another option would be to have lines automatically dashed-underlined and tooltipped and never appearing plain like pages can.(Addedline-with-landlines-with-ll.- Also, I haven't thought about how some poems have different sequences of lines for every chapter or something. I don't know if that crops up anywhere in Tolkien's verse.
- If TG had an abbreviation template like Wikipedia's Template:Abbr (but wait, what would an abbreviation template do that
{{tooltip}}itself wouldn't?),you could include a tooltip just for the obscure abbreviations I might use sometimes. This would not work if there was a multi-parameter tooltip, but the explanation of the abbreviation would be in there anyway. - Maybe drop the idea of "fail-safes" that remove
pandlinelines from the tooltip window ifp-with-pandline-with-lparameters are filled. Just trust the editor to make sure they only use one of the options, and to not use different values if they do you use both redundantly. And if they do make a mistake, it's easier to notice if everything is shown in the tooltip window.locandloc-longare a different case, though, because iflocis visible you'd still want to useloc-long, while you'd never want to use bothpandp-with-p.
- Maybe replace "p.###", "pp.###", "l.###", "ll.###", "n.#", "Ch.#" with "p###", "pp###", "l###", "ll###", "n#", "Ch#". At least in some cases; "Ch.#" seems like it needs the period.
- Instead of making a parameter for each "labeled" version ("p.###", "pp.###"), maybe there could just be a
labelsparameter you can set to|labels=on, thenpdoes "p.###" instead of "###".
To-do after looking at testcases
Maybe removedtp-fullfrom the conditions that make a colon not appear; saves a lot of coding space anyway.dtp-fullno longer has a colon removed, but oddlydtp-endhas a colon present when it's multi-parameter anddtp-endhas not been picked withbase-select.- I made it work, but I'm not certain I did it properly. I've satisfied all the testcases I had at the time, but I might be able to come up with some where this will fail.
Also, rationale for having a colon before adtp-fullbut not adtp-end: You could have "The Stone-eaters: DRS SE.09.12.144", but you would never have "DRS SE.09:.12.144".
Figure out the two options for the base of a multi-parameter tooltip. One version has a limit to around 6 if statements nested within each other, and the negative of the bottom if statement is "{{rpex}} error". The other version has maximum if statements, for pretty much every parameter.- Done. I've hidden the "safe" version, which has 6 layers, and left the "dangerous" version active, and even expanded it to 19 layers.
- Can the "6 layers" version take 1 more layer?
- Done. I've hidden the "safe" version, which has 6 layers, and left the "dangerous" version active, and even expanded it to 19 layers.
Things from old notes worth considering again
- Consider something for footnotes. As of now that could go in
locorloc-long. But maybe it could also be something that shows up in the tooltip just as "Footnote" if not empty, or if some default value... but could also show up as "First footnote", "Second footnote", "Footnote to §#"? - Perhaps think about another optional parameter that makes it so information in the base of a tooltip does not reappear in the tooltip (like the page number(s)).
- This is really unnecessary... but could be worth doing for the problem-solving challenge.
- The part that makes me "want it" is seeing an underlined tooltip with a base that's page(s) and the tooltip has the page(s) again and then the location, rather than just the location.
Abbreviations for "Note". "n.5"?Abbreviations for "Commentary". "c.§5"? "comm.§5"?- Have
loc-2be an alias forloc-long, to get across that it doesn't always have to be longer, it could just be something added to specify?- No, this wouldn't work since I have
loc-longoverwritelocin the tooltip window, they don't work in tandem.- Make a
loc-short, turnloc-longintoloc, and add aloc-2,?
- Make a
- No, this wouldn't work since I have
- Think again about whether to always italicize the quotation or to just leave it to the editor to italicize only when it's not English.
- Make separate versions of
{{rpex}}for DTP identifiers and lines of verse? That might ease the need for so many nested if statements and stuff.
Alternative: Sub-referencing
On Wikipedia, the author of Template:Reference page says that it has been rendered obsolete, by a |ref= parameter that creates an anchor which can be used by subsequent (and more specific?) references. From what I can tell so far.
See also https://meta.wikimedia.org/wiki/WMDE_Technical_Wishes/Sub-referencing. I can't tell if what's described on there can be used on Tolkien Gateway, it says some stuff about beta wikis. It's possible the effects of the system could be achieved with templates until it becomes a feature of MediaWiki itself? I guess that would mean creating a template for general citing and using that template within <ref></ref> instead of the <ref> tags alone. This general citing template would presumably be able to contain {{AA}}, {{GA}}, all the citation templates, {{Cite DTP}}, but also have a ref parameter that creates an anchor which another extension template can use and add to. Then you'd use that extension template alone in the inline rather than have a ref tag or general citing template followed by an extension template. The tricky part might be how to bundle all the extensions under their common general reference in a bulleted list or whatever.
It could be, though, that for whatever reason TG won't be prepared to adopt this thing Wikimedia is working on once it's ready and applied to all Wikimedia/MediaWiki wikis (for example, because it doesn't work well with TG's templates? or the templates would have to be reworked?), and so sticking with this rpex idea would be at least better than that.
See also https://www.mediawiki.org/wiki/Extension:Cite#Configuration for the possibility of already allowing this stuff on TG?
At the very least this thing is probably so close to being applied to MediaWiki wikis that it would be the worst time possible to make a template equivalent to it?
Historical notes
The Wikipedia template was created in 2007.
Template:Rp was created in 2013, and was basically left untouched until one edit in 2024.
Most text-specific citation templates seem to come from 2009 and 2010. I don't know if they replaced previous versions.
Testcases
{{User:Yaulendil/Template/Rp expanded|123}}
Test.[6]:123 Works.
Test.[6]:123 Works.
Test.[6]:123–45 Works.
Test.[6]:p.123 Works.
Test.[6]:pp.123–45 Works.
Test.[6]:§12 Works.
Test.[6]:§§12–23 Works.
Test.[6]:dust jacket Works.
Test.[6]:Text in Keladian cipher on dust jacket visible under ultraviolet light Works. But maybe shouldn't?
Test.[6]:n.5 Works. But maybe it should be :note 5, or :n.5.
Test.[6]:cmt.Commentary on§67 Works. But maybe (commentary) should be abbreviated somehow.
Test.[6]:cmt.Commentary on§§89–91 Works. But see previous.
Test.[6]:Ch.15 Works. But should it be ch.15 instead of Ch.15?
Test.[6]:"Gelasian Spring" Works.
Test.[6]:"The Lays of the Gelasian" Works.
Test.[6]:1050 Works.
Test.[6]:1050–1063 Works.
Test.[6]:"Ode to a Morain" Works.
Test.[6]:l.Line1050 Works.
Test.[6]:ll.Lines1050–1063 Works.
Test.[6]:quoteQuotation: "I heard my friend grinding stone on the other side of the arête." Works.
Test.[6]:translationTranslation: "I heard my friend grinding stone on the other side of the arête." Works.
Test.[6].12.144 Works.
Test.[6]:DRP SE.09.12.144 Works. But maybe it shouldn't.
Test.[6]:[hu] Works. But maybe it shouldn't.
Test.[6]:50 Works. But maybe it shouldn't.
Test.[6]:50–5 Works. But maybe it shouldn't.
Test.[6]:50 Works. But maybe it shouldn't.
Test.[6]:50–5 Works. But maybe it shouldn't.
Test.[6]:it was revealed to me in a dream Works. But maybe it shouldn't.
Test.[6]:{{rpex}} error
Test.[6]:123Page 123 Works.
Test.[6]:123Page 123 Works.
Test.[6]:123Page 123 Works.
Test.[6]:§12Page 123 Works.
Test.[6]:123Chapter 9: "Gelasian Spring"
Test.[6]:123Chapter: "Gelasian Spring"
Test.[6]:123Chapter 9
Test.[6]:123Page 123
Test.[6]:123Page 123
Test.[6]:123Page 123
Test.[6]:123Page 123
Test.[6].12.144Chapter 9: "Gelasian Spring" Works.
Test.[6].12.144Chapter 9: "Gelasian Spring" Works.
Test.[6]:123Chapter 9: "Gelasian Spring" Works.
Test.[6]:§12Chapter 9: "Gelasian Spring" Works.
Test.[6]:dust jacketChapter: "Gelasian Spring" This was to test both of the tooltip-base-hierarchy versions side-by-side, and it worked, though both versions show
Test.[6]:{{rpex}} errorChapter: "Gelasian Spring" This was to test both of the tooltip-base-hierarchy versions side-by-side, and it worked. The endless-nesting version shows ""The Lays of the Gelasian"" while the less-than-seven version shows "{{rpex}} error". This stopped working when I added things to the if statement stack. Now
Test.[6]: Hmm, if no parameters are used, do I want a bare colon to appear? Other options are: (1) nothing (2) "{{rpex}} error".
Test.[6]: Same bare colon if a pipe isn't there either.
Test.[6]:{{rpex}} errorTranslation: "I heard my friend grinding stone on the other side of the arête." Testing to see if I can get to the "19th layer" of the endless-nesting version. Huh, it was at the 19th? Not sure if that meant strictly the nesting if statements. Now
Test.[6]:{{rpex}} errorDTP identifier: DRP SE.09.12.144
Test.[6]:dust jacketLocation: dust jacket This works. Hm. Removing a bunch of layers actually lost this for me... and I thought I brought Okay, the above issue was just a typographical error. It actually fixed everything. Placing
Test.[6]:{{rpex}} errorTranslation: "I heard my friend grinding stone on the other side of the arête."
Test.[6]:{{rpex}} errorTranslation from p. 20: "I heard my friend grinding stone on the other side of the arête." Hm, is it even possible for me to get "{{rpex}} error" with the endless-nesting version? The issue here is that
Test.[6]:{{rpex}} errorTranslation from p. 20: "I heard my friend grinding stone on the other side of the arête." Okay, now I've got the error.
Test.[6]:{{rpex}} errorQuotation: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu] Same successful getting of that error. What happens if we remove the negative statement? It just disappears, leaving behind a bare colon, which is pretty much what the older versions did before I put a final negative statement like this error message.
Test.[6]:123 |
Old
Showing my work
(Sorry, I don't know how to get the text to wrap without changing it from how I'd originally typed it.)
(Oh, and I also only just noticed that nowiki tags are active within a pre box? Oops.)
First Attempt
<!--<includeonly>--><!--
COPIED FROM TEMPLATE:RP
--><!--<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">{{#ifeq:{{{1}}}|brackets|({{{2|}}})|:{{{1|}}}}}</sup>--><!--
FIRST ATTEMPT
--><!--<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;"><!--{{#ifeq:{{{1}}}|brackets|({{{2|}}})|:{{{1|}}}}}--><!--{{#if:{{{1|}}}|:{{{1|}}}}}{{#if:{{{dtp-end|}}}|{{{dtp-end|}}}}}<!--next make an if statement to find if there's only one non-null parameter besides default and dtp-end, and output this following sequence of if statements within it--><!--:{{#if:{{{p|}}}|{{{p|}}}|}}{{#if:{{{pp|}}}|{{{pp|}}}|}}{{#if:{{{para|}}}|§{{{para|}}}|}}{{#if:{{{paras|}}}|§§{{{paras|}}}|}}{{#if:{{{line|}}}|{{{line|}}}|}}{{#if:{{{lines|}}}|{{{lines|}}}|}}{{#if:{{{note|}}}|Note {{{note|}}}|}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}|}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}|}}{{#if:{{{loc|}}}|{{{loc|}}}|}}{{#if:{{{q|}}}|<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|}}{{#if:{{{t|}}}|<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|}}</sup><!--end brackets of the if statement mentioned in the previous hidden comment here--><!--this stretch also needs a conditional like what comes after, check for more than one non-null of the relevant things, since I can't put it into the tooltips, or at least I don't think I can--><!--<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">::</sup><!--end colon issue--><!--<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%; border-bottom:1px dashed"><!--now the cases where there are more than one non-null parameter besides default; in one case, the base of the tooltip will be the page number by default (and if page number is not one of the non-null parameters? can it go down a switch statement series of branches? that might be necessary since page and pages are separate parameters anyway), in the other, it will be specified by a parameter like {{{select-base}}}? which is mainly intended for paragraphs as the base instead of pages--><!--FIRST CASE BEGIN--><!--{{tooltip|{{#if:{{{p|}}}|{{{p|}}}|}}{{#if:{{{pp|}}}|{{{pp|}}}|}}{{#if:{{{para|}}}|§{{{para|}}}|}}{{#if:{{{paras|}}}|§§{{{paras|}}}|}}{{#if:{{{line|}}}|{{{line|}}}|}}{{#if:{{{lines|}}}|{{{lines|}}}|}}{{#if:{{{loc|}}}|{{{loc|}}}|}}|{{#if:{{{p|}}}|Page: {{{p|}}}<br>|}}{{#if:{{{pp|}}}|Pages: {{{pp|}}}<br>|}}{{#if:{{{para|}}}|§{{{para|}}}<br>|}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>|}}{{#if:{{{line|}}}|Line: {{{line|}}}<br>|}}{{#if:{{{lines|}}}|Lines: {{{lines|}}}<br>|}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>|}}{{#if:{{{note|}}}|Note {{{note|}}}<br>|}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>|}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>|}}<!--remember question of how to only show loc-long if loc-long is non-null (SOLVED)--><!--{{#if:{{{loc-long|}}}||{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>|}}}}{{#if:{{{loc-long|}}}|Location: {{{loc-long{{{loc-2|}}}}}}<br>|}}<!--end of loc and loc-long issue (SOLVED)--><!--{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>|}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>|}}{{#if:{{{dtp-full|}}}|DTP Reference: {{{dtp-full|}}}|}}}}<!--FIRST CASE END--><!--SECOND CASE BEGIN--><!--{{tooltip|{{{{{{base-select|}}}|}}}|{{#if:{{{p|}}}|Page: {{{p|}}}<br>|}}{{#if:{{{pp|}}}|Pages: {{{pp|}}}<br>|}}{{#if:{{{para|}}}|§{{{para|}}}<br>|}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>|}}{{#if:{{{line|}}}|Line: {{{line|}}}<br>|}}{{#if:{{{lines|}}}|Lines: {{{lines|}}}<br>|}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>|}}{{#if:{{{note|}}}|Note {{{note|}}}<br>|}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>|}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>|}}<!--remember question of how to only show loc-long if loc-long is non-null (SOLVED)--><!--{{#if:{{{loc-long|}}}||{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>|}}}}{{#if:{{{loc-long|}}}|Location: {{{loc-long{{{loc-2|}}}}}}<br>|}}<!--end of loc and loc-long issue (SOLVED)--><!--{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>|}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>|}}{{#if:{{{dtp-full|}}}|DTP Reference: {{{dtp-full|}}}|}}}}<!--SECOND CASE END--><!--end of multi-non-null stuff--><!--</sup>--><!--
Second Attempt
SECOND ATTEMPT (might be preferable to third and final?)
--><!--<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">--><!--
if the default parameter is not empty:
--><!--{{#if:{{{1|}}}|:{{{1|}}}|--><!--
if dtp-end is not empty:
--><!--{{#if:{{{dtp-end|}}}|{{#if:--><!--
testing for things other than dtp-end:
--><!--{{{dtp-full|}}}{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{loc|}}}{{{loc-long|}}}{{{q|}}}{{{t|}}}{{{lang|}}}--><!--
if there were things other than dtp-end, a tooltip:
--><!--|<span style="border-bottom:1px dashed">{{tooltip|{{{dtp-end|}}}|{{#if:{{{p|}}}|Page: {{{p|}}}<br>|}}{{#if:{{{pp|}}}|Pages: {{{pp|}}}<br>|}}{{#if:{{{para|}}}|§{{{para|}}}<br>|}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>|}}{{#if:{{{line|}}}|Line: {{{line|}}}<br>|}}{{#if:{{{lines|}}}|Lines: {{{lines|}}}<br>|}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>|}}{{#if:{{{note|}}}|Note {{{note|}}}<br>|}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>|}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>|}}{{#if:{{{loc-long|}}}||{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>|}}}}{{#if:{{{loc-long|}}}|Location: {{{loc-long{{{loc-2|}}}}}}<br>|}}{{#if:{{{lang|}}}|Quotation language: {{{lang|}}}<br>|}}{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>|}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>|}}{{#if:{{{dtp-full|}}}|DTP Reference: {{{dtp-full|}}}|}}}}</span>--><!--
if there was only dtp-end, then just it:
--><!--|{{{dtp-end|}}}}}|--><!--
testing for cases in which only one named parameter is not empty:
--><!--:{{#switch:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{loc|}}}{{{loc-long|}}}{{{q|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{t|}}}|{{{p|}}}={{{p|}}}|{{{pp|}}}={{{pp|}}}|{{{para|}}}=§{{{para|}}}|{{{paras|}}}=§§{{{paras|}}}|{{{line|}}}={{{line|}}}|{{{lines|}}}={{{lines|}}}|{{{loc|}}}={{{loc|}}}|{{{q|}}}=<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|{{{note|}}}=Note {{{note|}}}|{{{comment|}}}=Commentary on §{{{comment|}}}|{{{comments|}}}=Commentary on §§{{{comments|}}}|{{{t|}}}=<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|--><!--
--><!--#default=<span style="border-bottom:1px dashed">{{tooltip|--><!--
Here I'll try to figure out how to switch the base of the tooltip from page/pages to para/paras if indicated by the editor.
--><!--{{#switch:{{{base-select|}}}|para=§{{{para|}}}|paras=§§{{{paras|}}}|loc={{{loc|}}}|line={{{line|}}}|lines={{{lines|}}}}note=Note {{{note|}}}|comment=Commentary on §{{{comment|}}}|comments=Commentary on §§{{{comments|}}}|--><!--
--><!--{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{#if:{{{line|}}}|{{{line|}}}|{{{lines|}}}}}}}}}}}}}}}}}|{{#if:{{{p|}}}|Page: {{{p|}}}<br>|}}{{#if:{{{pp|}}}|Pages: {{{pp|}}}<br>|}}{{#if:{{{para|}}}|§{{{para|}}}<br>|}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>|}}{{#if:{{{line|}}}|Line: {{{line|}}}<br>|}}{{#if:{{{lines|}}}|Lines: {{{lines|}}}<br>|}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>|}}{{#if:{{{note|}}}|Note {{{note|}}}<br>|}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>|}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>|}}{{#if:{{{loc-long|}}}||{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>|}}}}{{#if:{{{loc-long|}}}|Location: {{{loc-long{{{loc-2|}}}}}}<br>|}}{{#if:{{{lang|}}}|Quotation language: {{{lang|}}}<br>|}}{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>|}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>|}}{{#if:{{{dtp-full|}}}|DTP Reference: {{{dtp-full|}}}|}}}}</span>}}}}}}</sup></includeonly><noinclude>
<sup class="references">:{{{1}}}</sup>--><!--
STARTING OVER FROM HERE
Third Attempt
THIRD AND FINAL ATTEMPT (as of putting this all aside in this pre block)
--><!--<includeonly>--><!--
everything will be superscripted to these specifications; dashed underlining shows up a few places later
--><sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;"><!--
if there is a default value, output this just like (or nearly just like) the original {{rp}} template; hopefully afterwards all the stuff in the "if not" branch isn't even considered
-->{{#if:{{{1|}}}|:{{{1|}}}|<!--
now we decide, just once and for all, whether or not there will be a colon
the last major issue with this code is that base-select can the dtp-end to be present in the tooltip window without being the base, resulting in a missing colon when it's not a dtp-end, so now this gets more complicated, and it may not be worth trying to decide the colon's presence or lack of separately here?
I could think about what conditions lead to the dtp-end or dtp-full showing up alone or at the base and work backwards to determine what the conditions are to not display a colon here.
hiding this next section in favor of the one following it:
--><!--{{#if:{{{dtp-end|}}}|{{#switch:{{{base-select|}}}|dtp-full|dtp-end=|#default=:}}|:}}--><!--
hiding this next one too, because I should start fresh.
--><!--{{#switch:{{{dtp-end|}}}{{{dtp-full|}}}{{{base-select|}}}{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{line|}}}{{{lines|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}|{{{dtp-end|}}}|{{{dtp-full|}}}|{{{dtp-end|}}}{{{dtp-full}}}|dtp-end|dtp-full=|#default=:}}--><!--
conditions that would result in dtp-end or dtp-full being the base: (1) dtp-end the only parameter used (2) dtp-full the only parameter used (3) dtp-end and dtp-full the only two parameters used (4) dtp-end called by {{base-select}} (5) dtp-full called by {{base-select}} (6) dtp-end used, and {{base-select}} was not used to call {{p}}, {{pp}}, {{para}}, {{paras}}, {{line}}, {{lines}}, {{loc}}, {{subchapter}}, {{note}}, {{comment}}, or {{comments}}
-->{{#switch:{{{dtp-end|}}}{{{dtp-full|}}}|{{{dtp-end|}}}={{#switch:{{{base-select|}}}|dtp-end=|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-end|}}}||:}}}}|{{{dtp-full|}}}={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-full|}}}||:}}|{{{dtp-end|}}}{{{dtp-full|}}}={{#switch:{{{base-select|}}}|dtp-end=|p|pp|para|paras|line|lines|note|comment|comments|loc|subchapter=:|#default=}}|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-end|}}}{{{dtp-full|}}}||:}}}}<!--
should I give up on this? the colon seems like the hardest part...
I think I've achieved it, but it's an incredible amount of checks just to prevent a colon from showing up before DTP references, maybe my previous ideas that I turned into hidden comments were more efficient.
now, decide with a split-up tooltip template in an if statement which does not hold the rest of the code nested within it if there will be an underlined tooltip or not?
hmm, it would have to be a switch statement, wouldn't it?
okay (see "no, this isn't going to work" below), now this switch statement will just be checking if there's more than one of any of these parameters filled
-->{{#switch:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|<!--
I'm going to see if it's better to group the results into a long string, rather than have each branch with a separate string... no, I would have to add if statements within the long string to hide the characters around the parameter outputs, so the least redundant thing would be to have each branch give a different output
-->{{{p|}}}={{{p|}}}|{{{pp|}}}={{{pp|}}}|{{{para|}}}=§{{{para|}}}|{{{paras|}}}=§§{{{paras|}}}|{{{loc|}}}={{{loc|}}}|{{{subchapter|}}}={{{subchapter|}}}|{{{line|}}}={{{line|}}}|{{{lines|}}}={{{lines|}}}|{{{note|}}}=Note {{{note|}}}|{{{comment|}}}=Commentary on §{{{comment|}}}|{{{comments|}}}=Commentary on §§{{{comments|}}}|{{{dtp-end|}}}={{{dtp-end|}}}|{{{q|}}}=<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|{{{t|}}}=<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|#default=<!--
no, this isn't going to work, I have to close the switch statement, but it's always going to interpret that as closing the tooltip, right?
Should I nest the next switch statement within the default of the prior? Or, just leave the default null or don't even bring up the default, and move on to a next switch statement? I'll do the latter, leaving a #default= for now.
okay, maybe next it won't be a switch statement, but a series of if statements?
--><span style="border-bottom:1px dashed">{{tooltip|{{#switch:{{{base-select|}}}|p={{{p|}}}|pp={{{pp|}}}|para=§{{{para|}}}|paras=§§{{{paras|}}}|loc={{{loc|}}}|subchapter={{{subchapter|}}}|line={{{line|}}}|lines={{{lines|}}}|note=Note {{{note|}}}|comment=Commentary on §{{{comment|}}}|comments=Commentary on §§{{{comments|}}}|dtp-end={{{dtp-end|}}}|dtp-full={{{dtp-full}}}<!--
the base-select is determined, now we do a default going in a certain default order since there can be only one in the second parameter of a tooltip
-->|#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{line|}}}|{{{line|}}}|{{#if:{{{lines|}}}|{{{lines|}}}|{{#if:{{{note|}}}|Note {{{note|}}}|{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}|{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{#if:{{{subchapter|}}}|{{{subchapter|}}}|{{#if:{{{dtp-full|}}}|{{{dtp-full}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}<!--
the second parameter of the tooltip (base) is established, now comes the tooltip window, which will always be the same as long as more than one of the relevant parameters exists
-->|{{#if:{{{p|}}}|Page {{{p|}}}<br>}}{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>}}{{#if:{{{para|}}}|§{{{para|}}}<br>}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>}}{{#if:{{{line|}}}|Line {{{line|}}}<br>}}{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>}}{{#if:{{{note|}}}|Note {{{note|}}}<br>}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>}}{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}{{#if:{{{subchapter|}}}|{{{subchapter|}}}<br>}}{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>}}{{#if:{{{lang|}}}|Language: {{{lang|}}}<br>}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>}}{{#if:{{{dtp-full|}}}|DTP reference: {{{dtp-full|}}}}}}}</span>}}<!--
end the original if statement within which all is nested and the superscript
-->}}</sup></includeonly><noinclude>
<sup class="references">:{{{1}}}</sup>
"Description of the Code" from Third/Fourth Attempt
(I only just realize that the nowiki tags are active in pre boxes. I'll think about how best to display this later, if anyone wants to really review this I guess you'll have to look at the page source.)
<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">
Using the same style as the original template, which wasn't normal superscript.
{{#if:{{{1|}}}|:{{{1|}}}|
Seeing if the default parameter was used, as should be the case for all preexisting uses of {{rp}}. If it was, it outputs something identical to the original code. If not, all the rest of the code is in the negative branch of this if statement.
Note the difference with the original code:
{{#ifeq:{{{1}}}|brackets|({{{2|}}})|:{{{1|}}}}}
I didn't understand what it means to compare the default parameter to "brackets", if that's literally just the string "brackets" or what, and I didn't understand what {{{2|}}} was, so I started from scratch.
{{#switch:{{{dtp-end|}}}{{{dtp-full|}}}|{{{dtp-end|}}}={{#switch:{{{base-select|}}}|dtp-end=|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-end|}}}||:}}}}|{{{dtp-full|}}}={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-full|}}}||:}}|{{{dtp-end|}}}{{{dtp-full|}}}={{#switch:{{{base-select|}}}|dtp-end=|p|pp|para|paras|line|lines|note|comment|comments|loc|subchapter=:|#default=}}|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-end|}}}{{{dtp-full|}}}||:}}}}
This is the most nightmarish part. The goal is to "predict" whether or not either of parameters dtp-end or dtp-full will be the visible part rather than hidden in the tooltip. If a full or partial DTP identifier is the visible part, no colon is prepended, otherwise a colon is prepended. It's difficult because there are multiple scenarios which would cause those parameters to be visible. Honestly, I wasn't entirely sure what I was thinking, sort of trial-and-erroring it, and stopped when my test cases gave me what I wanted.
It's a lot of writing just to satisfy an aesthetic preference. I think this[4]:.04.024 looks bad and this[4].04.024 looks good.
But maybe it would be more consistent to keep the colon in all cases, on top of reducing the size of the code.
Following Wikipedia's example, I also want the dashed underline to not appear under the colon, so like this[1]:§113 instead of like this.[1]:§113 That places some limits on introducing colons in more specific cases deeper within the nested statements, within the tooltips.
The rest of the code is all under a single switch statement.
{{#switch:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{p|}}}={{{p|}}}|{{{pp|}}}={{{pp|}}}|{{{para|}}}=§{{{para|}}}|{{{paras|}}}=§§{{{paras|}}}|{{{loc|}}}={{{loc|}}}|{{{subchapter|}}}={{{subchapter|}}}|{{{line|}}}={{{line|}}}|{{{lines|}}}={{{lines|}}}|{{{note|}}}=Note {{{note|}}}|{{{comment|}}}=Commentary on §{{{comment|}}}|{{{comments|}}}=Commentary on §§{{{comments|}}}|{{{dtp-end|}}}={{{dtp-end|}}}|{{{q|}}}=<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|{{{t|}}}=<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|
This is that switch statement before the #default branch. It takes in a bunch of parameters and then goes through all the cases in which only 1 parameter was used, putting out the result without a tooltip window and without a dashed underline.
Except in the case of {{{q}}} and {{{t}}}, because those cases are too long to not hide within a tooltip. If for some reason an editor does use this template for just {{{q}}} or {{{t}}}, the results look like this[5]:quoteQuotation: "Ahogy az erdőre hív, úgy visít vissza." and this.[5]:translationTranslation: "As you call into the forest, so it echoes back."
If more than one of these parameters are used, we go to the default case...
#default=<span style="border-bottom:1px dashed">{{tooltip|
...that introduces a tooltip.
{{#switch:{{{base-select|}}}|p={{{p|}}}|pp={{{pp|}}}|para=§{{{para|}}}|paras=§§{{{paras|}}}|loc={{{loc|}}}|subchapter={{{subchapter|}}}|line={{{line|}}}|lines={{{lines|}}}|note=Note {{{note|}}}|comment=Commentary on §{{{comment|}}}|comments=Commentary on §§{{{comments|}}}|dtp-end={{{dtp-end|}}}|dtp-full={{{dtp-full}}}
The visible part of the tooltip is determined by a switch statement, which first determines the contents of the {{{base-select}}} parameter. This parameter is for cases like where you've included the page number(s) as a parameter but still want the paragraphs or lines to be the visible part, like when referencing the Annals or maybe when referencing poetry.
The default case of this switch statement has a hierarchy or priority of parameters to make the visible one if {{{base-select}}} wasn't called:
|#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{line|}}}|{{{line|}}}|{{#if:{{{lines|}}}|{{{lines|}}}|{{#if:{{{note|}}}|Note {{{note|}}}|{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}|{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{#if:{{{dtp-full|}}}|{{{dtp-full}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
Note that this is where I have thirteen nested if statements. Seventeen if we're counting anything nested within anything. Maybe I could change it to a switch statement, since once it finds a first matching case/branch is stops, and I can just order the branches in this hierarchy?
(It's now 12 nested ifs, 16 nested anythings. I removed subchapter from the possible bases.)
It might be trickier to use a switch statement that I thought. I don't know how to test if there's any occurrence of the parameter rather than if it's the only occurring parameter out of the possible ones before the cases and branches.
Also, maybe remove subchapter as a possible base.
What would be convenientt is if cases/branches of a swtich statement could determine if there is any occurrence of a parameter rather than only an occurrence of a parameter out of all the parameters tested. But I don't see a way to do that yet.
Another solution I'm thinking of is to remove most of the nested if statements from this "default" base-choosing, so that maybe only dtp-end, p, pp, para, paras, and loc are possible "default" bases, and if none of those are present you get a "failure mode" of just a colon with no tooltip, or maybe a red dashed-underlined tooltip saying "choose a base with parameter base-select". And if you want anything besides those 6 parameters to be the visible base, you have to resort to base-select. You can make as many cases for base-select's switch statement as you want, including chapter and subchapter, and if we only ever use chapter consciously, you could expect the editor to only use it if the chapter is in number form only (or make two separate parameters, chapter-number and chapter, and chapter-number is output into the visible base like :Ch.14). The longer switch statement could also have multiple options for the same chosen parameter. Like |base-select=p could output :123 while |base-select=p-with-p could output :p.123 or maybe :p123.
(Except I might not be able to turn text red within the first parameter of a tooltip, only outside the tooltip template.)
(And, maybe p-with-p could be its own parameter, instead of just another way to call p in that switch statement. Could use it even when it's the only parameter called.)
And now the second parameter in the tooltip is filled out...
|{{#if:{{{p|}}}|Page {{{p|}}}<br>}}{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>}}{{#if:{{{para|}}}|§{{{para|}}}<br>}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>}}{{#if:{{{line|}}}|Line {{{line|}}}<br>}}{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>}}{{#if:{{{note|}}}|Note {{{note|}}}<br>}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>}}{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}{{#if:{{{subchapter|}}}|{{{subchapter|}}}<br>}}{{#if:{{{q|}}}|Quotation: "{{{q|}}}"<br>}}{{#if:{{{lang|}}}|Language: {{{lang|}}}<br>}}{{#if:{{{t|}}}|Translation: "{{{t|}}}"<br>}}{{#if:{{{dtp-full|}}}|DTP identifier: {{{dtp-full|}}}}}}}
(Replaced with:)
|{{#if:{{{p|}}}|Page {{{p|}}}<br>}}{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>}}{{#if:{{{para|}}}|§{{{para|}}}<br>}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>}}{{#if:{{{note|}}}|Note {{{note|}}}<br>}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>}}{{#if:{{{line|}}}|Line {{{line|}}}<br>}}{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>}}{{#if:{{{chapter|}}}|Chapter: {{{chapter|}}}<br>}}{{#if:{{{subchapter|}}}|Subchapter: {{{subchapter|}}}<br>}}{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}{{#if:{{{q|}}}|Quotation{{#if:{{{qp|}}}| from p. {{{qp|}}}}}{{#if:{{{qpp|}}}| from pp. {{{qpp|}}}}}: "{{{q|}}}" {{#if:{{{lang|}}}| ({{{lang|}}})}}<br>}}{{#if:{{{t|}}}|Translation{{#if:{{{tp|}}}| from p. {{{tp|}}}}}{{#if:{{{tpp|}}}| from pp. {{{tpp|}}}}}: "{{{t|}}}"<br>}}{{#if:{{{dtp-full|}}}|DTP identifier: {{{dtp-full|}}}}}}}
...which will always be the same whenever a tooltip is used (except in the unique cases of {{{q}}} and {{{t}}} above). Using if statements it just shows whatever parameters were provided in a certain order.
The only tricky part here is {{{loc}}} and {{{loc-long}}}. There could be cases where the editor is referencing something that can only be specified by location, which needs to be brief as visible but the tooltip can describe this location more specifically. So when both {{{loc}}} and {{{loc-long}}} are used the short {{{loc}}} drops out from what's expressed in the tooltip window.
An example with everything filled out.[8]:1233–5Chapter: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 1234
Pages 1233–5
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 789
Lines 789–95
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322: "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
The code of the above: {{User:Yaulendil/Template/Rp expanded|p=1234|pp=1233–5|para=321|paras=311–31|line=789|lines=789–95|line-loc="Ode to a Morain"|note=15|comment=15|comments=1–150|loc=Braille footnote|loc-long=Braille footnote running diagonally from lower-left corner of page|chapter=Gelasian Spring|subchapter=The Lays of the Gelasian|dtp-end=.12.144|dtp-full=DRP SE.09.12.144|q=<i>Hallottam, amint a barátom követ köszörül az arête túloldalán.</i>|lang=hu|t=I heard my friend grinding stone on the other side of the arête.|qp=1235|qpp=1234–35|tp=4321|tpp=4320–4322|base-select=pp}}
Without the {{{base-select}}}: Example.[8].12.144Chapter: "Gelasian Spring"
Subchapter: "The Lays of the Gelasian"
Page 1234
Pages 1233–5
§321
§§311–31
Note 15
Commentary on §15
Commentary on §§1–150
Line 789
Lines 789–95
Verse location: "Ode to a Morain"
Location: Braille footnote running diagonally from lower-left corner of page
Quotation from p. 1235 from pp. 1234–35: "Hallottam, amint a barátom követ köszörül az arête túloldalán." [hu]
Translation from p. 4321 from pp. 4320–4322: "I heard my friend grinding stone on the other side of the arête."
DTP identifier: DRP SE.09.12.144
Oddly, the space does come between the end-quote around the quotation parameter and the start-parenthesis before the language abbreviation, but not between the n in "Question" and the o in " on p." and " on pp.". Tried to include the leading spaces with <noinclude /> tags but it didn't help. Fixed with HTML tags; and those don't appear in the pre tag box.
(Note to self: I could come up with a better order for items in the tooltip window.)
(Note to self: I wonder what Wikipedia does if you include both p and pp?)
{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}
(This is a "closeup" of that bit with {{{loc}}} and {{{loc-long}}}.)
|Quotation{{#if:{{{qp|}}}| on p. {{{qp|}}}|}}{{#if:{{{qpp|}}}| on p. {{{qpp|}}}|}}: "{{{q|}}}" {{#if:{{{lang|}}}| ({{{lang|}}})|}}<br>}}
(This is some new code replacing the quotation and language parts of the last big block.)
(I've done the same for the translation part, now with tp and tpp. And I've fixed the leading whitespace issue using HTML codes and changed the "on"s to "from"s.)
</span>}}}}</sup>
Closing the dashed underline of the tooltip, the switch statement of everything after the possible colon, the if statement that included the default parameter, and the superscript of the whole template.
It's possible that the above is inferior to what I had under "SECOND ATTEMPT" in #Showing my work, particularly when it comes to determining whether to include a colon.
Fourth/Fifth Attempt
FOURTH ATTEMPT, or kinda like the fifth attempt
<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;">{{#if:{{{1|}}}|:{{{1|}}}|<!--IF EVERYTHING GETS A COLON, USE THIS INSTEAD--><!--:--><!--END EVERYTHING GETTING A COLON--><!--COLON DECIDER BEGINS--><!--NECESSARY PART BEGIN--><!--{{#switch:{{{dtp-end|}}}--><!--NECESSARY PART BREAK--><!--{{{dtp-full|}}}--><!--NECESSARY PART RESUME--><!--|{{{dtp-end|}}}={{#switch:{{{base-select|}}}|dtp-end=|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}{{{p-with-p|}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}|{{{dtp-end|}}}||:}}}}--><!--NECESSARY PART END-->{{#if:{{{dtp-end|}}}|{{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{p-with-p|}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}{{{dtp-end|}}}{{{dtp-full|}}}|{{{dtp-end|}}}||{{#if:{{{base-select|}}}|{{#switch:{{{base-select|}}}|dtp-end=|=|#default=:}}}}|:}}|:}}<!--|{{{dtp-full|}}}={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-full|}}}{{{p-with-p||}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}||:}}--><!--|{{{dtp-end|}}}--><!--{{{dtp-full|}}}--><!--={{#switch:{{{base-select|}}}|dtp-end=|p|pp|para|paras|line|lines|note|comment|comments|loc|subchapter|dtp-full|#default=:}}|#default={{#ifeq:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}|{{{dtp-end|}}}{{{dtp-full|}}}||:}}--><!--}}--><!--COLON DECIDER ENDS-->{{#switch:{{{p|}}}{{{pp|}}}{{{para|}}}{{{paras|}}}{{{loc|}}}{{{loc-long|}}}{{{chapter-num|}}}{{{chapter|}}}{{{subchapter|}}}{{{line|}}}{{{lines|}}}{{{line-loc|}}}{{{note|}}}{{{comment|}}}{{{comments|}}}{{{dtp-end|}}}{{{dtp-full|}}}{{{q|}}}{{{lang|}}}{{{t|}}}{{{p-with-p|}}}{{{pp-with-pp|}}}{{{line-with-l|}}}{{{lines-with-ll|}}}{{{base-select|}}}|{{{p|}}}={{{p|}}}|{{{pp|}}}={{{pp|}}}|{{{para|}}}=§{{{para|}}}|{{{paras|}}}=§§{{{paras|}}}|{{{loc|}}}={{{loc|}}}|{{{loc-long|}}}={{{loc-long|}}}|{{{chapter-num|}}}=Ch.{{{chapter-num|}}}|{{{chapter|}}}="{{{chapter|}}}"|{{{subchapter|}}}="{{{subchapter|}}}"|{{{line|}}}={{{line|}}}|{{{lines|}}}={{{lines|}}}|{{{line-loc|}}}={{{line-loc|}}}|{{{note|}}}=Note {{{note|}}}|{{{comment|}}}=§{{{comment|}}} (commentary)|{{{comments|}}}=§§{{{comments|}}} (commentary)|{{{dtp-end|}}}={{{dtp-end|}}}|{{{dtp-full|}}}={{{dtp-full|}}}|{{{q|}}}=<span style="border-bottom:1px dashed">{{tooltip|quote|Quotation: "{{{q|}}}"}}</span>|{{{t|}}}=<span style="border-bottom:1px dashed">{{tooltip|translation|Translation: "{{{t|}}}"}}</span>|{{{lang|}}}=({{{lang|}}})|{{{p-with-p|}}}=p.{{{p-with-p|}}}|{{{pp-with-pp|}}}=pp.{{{pp-with-pp|}}}|{{{line-with-l|}}}=l.{{{line-with-l|}}}|{{{lines-with-ll|}}}=ll.{{{lines-with-ll}}}|{{{base-select|}}}={{rpex}} error|#default=<span style="border-bottom:1px dashed">{{tooltip|{{#switch:{{{base-select|}}}|p={{{p|}}}|pp={{{pp|}}}|para=§{{{para|}}}|paras=§§{{{paras|}}}|loc={{{loc|}}}|loc-long={{{loc-long|}}}|chapter-num=Ch.{{{chapter-num|}}}|chapter="{{{chapter|}}}"|subchapter="{{{subchapter|}}}"|line={{{line|}}}|lines={{{lines|}}}|note=Note {{{note|}}}|comment=§{{{comment|}}} (commentary)|comments=§§{{{comments|}}} (commentary)|dtp-end={{{dtp-end|}}}|dtp-full={{{dtp-full}}}|p-with-p=p.{{{p-with-p|}}}|pp-with-pp=pp.{{{pp-with-pp|}}}|line-with-l=l.{{{line-with-l|}}}|lines-with-ll=ll.{{{lines-with-ll|}}}|<!--BEGIN QUESTIONABLE NESTED IF STATEMENTS-->#default={{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{p-with-p|}}}|{{{p-with-p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{pp-with-pp|}}}|{{{pp-with-pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{line|}}}|{{{line|}}}|{{#if:{{{line-with-l|}}}|{{{line-with-l|}}}|{{#if:{{{lines|}}}|{{{lines|}}}|{{#if:{{{lines-with-ll|}}}|{{{lines-with-ll|}}}|{{#if:{{{note|}}}|Note {{{note|}}}|{{#if:{{{comment|}}}|§{{{comment|}}} (commentary)|{{#if:{{{comments|}}}|§§{{{comments|}}} (commentary)|{{#if:{{{loc|}}}|{{{loc|}}}|{{#if:{{{subchapter|}}}|"{{{subchapter|}}}"|{{#if:{{{chapter-num|}}}|Ch.{{{chapter-num}}}|{{#if:{{{chapter|}}}|"{{{chapter|}}}"|{{#if:{{{dtp-full|}}}|{{{dtp-full}}}|{{rpex}} error}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}<!--END QUESTIONABLE NESTED IF STATEMENTS--><!--BEGIN REPLACEMENT OF QUESTIONABLE IF STATEMENTS--><!--{{#if:{{{dtp-end|}}}|{{{dtp-end|}}}|{{#if:{{{p|}}}|{{{p|}}}|{{#if:{{{pp|}}}|{{{pp|}}}|{{#if:{{{para|}}}|§{{{para|}}}|{{#if:{{{paras|}}}|§§{{{paras|}}}|{{#if:{{{loc|}}}|{{{loc|}}}|{{rpex}} error}}}}}}}}}}}}--><!--END REPLACEMENT OF QUESTIONABLE IF STATEMENTS-->}}|<!--BEGIN TOOLTIP WINDOW-->{{#if:{{{p|}}}|Page {{{p|}}}<br>|{{#if:{{{p-with-p|}}}|Page {{{p-with-p|}}}<br>}}}}{{#if:{{{pp|}}}|Pages {{{pp|}}}<br>|{{#if:{{{pp-with-pp|}}}|Pages {{{pp-with-pp|}}}<br>}}}}{{#if:{{{para|}}}|§{{{para|}}}<br>}}{{#if:{{{paras|}}}|§§{{{paras|}}}<br>}}{{#if:{{{note|}}}|Note {{{note|}}}<br>}}{{#if:{{{comment|}}}|Commentary on §{{{comment|}}}<br>}}{{#if:{{{comments|}}}|Commentary on §§{{{comments|}}}<br>}}{{#if:{{{line|}}}|Line {{{line|}}}<br>|{{#if:{{{line-with-l|}}}|Line {{{line-with-l|}}}<br>}}}}{{#if:{{{lines|}}}|Lines {{{lines|}}}<br>|{{#if:{{{lines-with-ll|}}}|Lines {{{lines-with-ll|}}}<br>}}}}{{#if:{{{line-loc|}}}|Verse location: {{{line-loc|}}}<br>}}{{#if:{{{chapter|}}}|Chapter{{#if:{{{chapter-num|}}}| {{{chapter-num|}}}}}: "{{{chapter|}}}"<br>|{{#if:{{{chapter-num|}}}|Chapter {{{chapter-num|}}}<br>}}}}{{#if:{{{subchapter|}}}|Subchapter: "{{{subchapter|}}}"<br>}}{{#if:{{{loc-long|}}}|Location: {{{loc-long|}}}<br>|{{#if:{{{loc|}}}|Location: {{{loc|}}}<br>}}}}{{#if:{{{q|}}}|Quotation{{#if:{{{qp|}}}| from p. {{{qp|}}}}}{{#if:{{{qpp|}}}| from pp. {{{qpp|}}}}}: "{{{q|}}}"{{#if:{{{lang|}}}| ({{{lang|}}})}}<br>}}{{#if:{{{t|}}}|Translation{{#if:{{{tp|}}}| from p. {{{tp|}}}}}{{#if:{{{tpp|}}}| from pp. {{{tpp|}}}}}{{#if:{{{t-source|}}}| ({{{t-source|}}})}}: "{{{t|}}}"<br>}}{{#if:{{{dtp-full|}}}|DTP identifier: {{{dtp-full|}}}}}<!--END TOOLTIP WINDOW-->}}</span>}}}}</sup>
Purpose and goals (old)
I held off on continuing my edits to the Timeline pages because I thought my use of Template:Rp was making it too cluttered and unreadable. One solution would have been to only use {{rp}} for page and paragraph numbers, but I didn't like having to sacrifice pointing to particular notes, paragraph commentaries, and descriptions by doing that. For example, this[1]:Note on §85, p. 106 could become this,[1]:106 but at the loss of a pointer to the exact place on the page. In the long run that's a perfectly appropriate sacrifice to make, but I wondered if there was a better way. (Like, with this page's template, this;[1]:106Page 106
Commentary on §85
MouseOver the underlined part.)
This coincided with a few other problems:
- It bothered me to have to type up the § symbol each time I wanted to cite a paragraph number in the Annals instead of a page.
- Sometimes I felt the need to include a brief quote within a reference (see especially, on the 13 February 2025 version of Timeline/Second Age, refs 10 to 16, obscure years in "The Mariner's Wife" that you have to piece together from the text), which meant I couldn't just bundle it under a more general reference and point to a page number with
{{rp}}, not even if I'd had a pre-1992 edition of Unfinished Tales. {{rp}}would not work well with{{Cite DTP}}identifiers.
Wikipedia pointed me to possible solutions. Their Template:Reference page is more expansive than Tolkien Gateway's, allowing you to specify if you're using one or multiple pages, a location not within any page, and if you are including a quote, hiding that quote (and its translation) within a tooltip window that appears when you hover over the page number. (Note to self: Wikipedia also allows you to cite a page on which the quote occurs distinct from the rest of the page or pages cited, I didn't include anything like that.)
That motivated me to make this template page. My goal was more ambitious—and, I'm sure, doomed to be overdesigned even if I did understand programming fundamentals—than just duplicating Wikipedia's version.
- I wanted to use the MouseOver tooltip window not just for quotes and translations, but also for extra specifics like a particular note or paragraph commentaries.
- Example.[1]:106Page 106
Commentary on §85
- Example.[1]:106Page 106
- I wanted to be able to specify that paragraphs instead of pages were being cited, since that was the standard with the
{{AA}}and{{GA}}templates, and automatically include § symbols just by specifying parameters for paragraphs instead of pages. I wanted to be able to specify that paragraph numbers should appear in the superscript and pages in the tooltip box, even if parameters for both are called (to resemble the automatic output of{{AA}}and{{GA}}). - I wanted to be able to cite by lines of verse instead of pages or paragraph numbers, which potentially seemed useful if citing a particular lay from The Lays of Beleriand, even though I've never seen anyone do that on TG and page numbers seem a better way to do it since (I think) no versions of The Lays of Beleriand differ by page number.
- Example with just lines.[2]:1164–6 Example with details.[3]:1164–6Page 193
Lines 1164–6
Verse location: The Lay of Leithian, Canto IV
Example with details and page number as the visible.[3]:193Page 193
Lines 1164–6
Verse location: The Lay of Leithian, Canto IV
- {Note: Is
{{LB}}broken when not specifying a part or chapter?)
- {Note: Is
- Example with just lines.[2]:1164–6 Example with details.[3]:1164–6Page 193
- I wanted to be able to cite by DTP identifiers.
- Example.[4].04.024 Example with details.[4].04.024DTP identifier: LR 4.04.024 Full identifier visible.[4]:LR 4.04.024
(Note to self: That shouldn't have the tooltip? Even though it's not intended to be used in the first place.)(Fixed.)- (Note: Should
{{Cite DTP|LR 4}}include "Book 4" in the reference instead of just "The Two Towers"?)
- (Note: Should
- Example.[4].04.024 Example with details.[4].04.024DTP identifier: LR 4.04.024 Full identifier visible.[4]:LR 4.04.024
My goal was a Swiss Army knife. Which I understand is probably a bad idea from the start, going against a keep-it-simple-stupid principle, even if I did understand programming fundamentals, which I do not.
I think what I've made is what they call spaghetti code, but it seems to work as intended. I haven't seen it outright fail any test case, but I haven't tested all possible variations of using it.
I'm wondering if I could move it from this User subpage into an actual template page, perhaps as Template:Rp ex. Or even into Template:Rp since, if only the default parameter is used, mine should output the same as what the original did, and I think not even process the rest of the complicated code. (But the code for the default parameter is different! I didn't understand the original's so started from scratch.)
I would need someone to look over my code above and make sure it won't somehow crash the site, or create page-loading issues, or mobile browser compatibility issues, stuff like that. It's probably very needlessly inefficient, and there might be ways it could mess up that I haven't considered. (For example, what if a location description or title included an equal sign? I haven't considered if that could be an issue, and know = sometimes has to be replaced with {{=}}.)
(In particular, I'm surprised the site allowed me to nest so many if statements within each other. I read here that wikis limit the number of nestings to seven. Surely I nested more than that? Yeah, there are at least thirteen nested if statements within a switch statement. Maybe I should add a fourteenth just for luck. The switch is within a tooltip within a switch within an if statement, so that's fourteen if statements, seventeen statements counting the two switch statements and tooltip. It's possible that this is allowed in the User namespace but won't be allowed in the Template namespace.)
(After further testing, I think the limit is 15 if statements? See in #Description of the code where there are three versions, with 15, 6, and 21 nested if statements each.)
(Another thing that needs to be determined before I start using it is whether naming conventions and such are appropriate, since changing parameter names afterwards could be very tedious, I figure.)
If it passes a basic safety test, I could go ahead and use it until someone (even myself) has the time to make a proper version of it. It could work as a makeshift, particularly for my edits to the Timeline pages, so long as when this template improves it gives basically the same outputs.
(Biggest non-technical problem would probably just be that it's too idiosyncratic. There's probably no wiki where an underlined tooltip is used to contain information besides quote- and translation-related things. But is there a hard rule against not adding something idiosyncratic to a wiki?)
If even using it as a makeshift is too dangerous, though, oh well, I had some fun with it.
Test it out? (used to be under "Alternative: Sub-referencing")
The version on the main Wikimedia page, [1]:
(removed)
<ref name="GAExample">{{GA}}</ref><ref extends="GAExample">§1</ref>
The version on the talk page, [2]:
(removed)
<ref name="GAExample" /><ref name="GAExample" details="§1" />
Nope, doesn't work.
I wonder if using {{reflist}} instead of {{references}} would make a difference? Does TG have both?
Nope, didn't work that way either.
Old notes
I'm throwing my hands up into the air regarding how to get the colons to disappear only when a dtp-end or dtp-full are the visible part, since there are so many different ways for them to be the visible part.
My current code satisfies at least the tests I've come up with so far. But it's all a lot of statements just to decide whether to prepend a colon or not. It's kind of nice, though.
Do I never violate seven layers of nested if statements? A guide somewhere says that that violates a memory limit.
Would it be able to handle things like automatically converting certain hyphens to en-dashes, and adding paragraph symbols when they're forgotten if the {{{para}}} and {{{paras}}} parameters are used?
And then there's the matter of providing multiple names for parameters, and if I need to repeat that each time or not.
Everything and the kitchen sink test:
[9]:12Subchapter: ""One Million Years of Celsitude""
Page 12
Pages 34–5
§6
§§7–8
Note 12
Commentary on §13
Commentary on §§14–15
Line 1009
Lines 1010–11
Verse location: "Ode to the Morain"
Location: This should appear
Quotation: "Ahogy az erdőre hív, úgy visít vissza." [hu]
Translation: "As you call into the forest, so it echoes back."
DTP identifier: SE GM.04.024
But note that double-apostrophes don't seem to work within the quote parameter, but HTML tags do seem to work there.
Everything, the kitchen sink, and dtp-end test:
[10].024Subchapter: ""One Million Years of Celsitude""
Page 12
Pages 34–5
§6
§§7–8
Note 12
Commentary on §13
Commentary on §§14–15
Line 1009
Lines 1010–11
Verse location: "Ode to the Morain"
Location: This should appear
Quotation: "Ahogy az erdőre hív, úgy visít vissza." [hu]
Translation: "As you call into the forest, so it echoes back."
DTP identifier: SE GM.04.024
Everything, the kitchen sink, dtp-end, and base-select to paragraph (paragraphs, not paragraph):
[10]:§§7–8Subchapter: ""One Million Years of Celsitude""
Page 12
Pages 34–5
§6
§§7–8
Note 12
Commentary on §13
Commentary on §§14–15
Line 1009
Lines 1010–11
Verse location: "Ode to the Morain"
Location: This should appear
Quotation: "Ahogy az erdőre hív, úgy visít vissza." [hu]
Translation: "As you call into the forest, so it echoes back."
DTP identifier: SE GM.04.024
This creates a unique problem where the colon is taken away simply because dtp-end exists as a parameter even though it's not expressed in the base.
Quote alone test:
[10]:quoteQuotation: "Ahogy az erdőre hív, úgy visít vissza."
Hmm, the quotes worked everywhere else, but not here.
Translation alone test:
[10]:translationTranslation: "As you call into the forest, so it echoes back."
Oof, failure. Fixed.
Lines alone test:
[10]:1010–11
Oof, failure. Fixed.
dtp-full alone test:
[10]:SE GM.04.024
That's a little janky... but really you didn't want a full DTP reference to be appearable anyway.
Oh, and wouldn't you want the dtp-full to be non-underlined if you were to allow it to show up alone?
Also, "Location:" (for loc-long) is always appearing even when empty. Can't see, but I bet I fixed this.
Also, here the colon is included before the DTP Reference... but that's appropriate since it isn't a broken-up link. Besides, nobody should ever use this outcome.
And figure out if you have to add the other parameter names into each parameter each time they appear.
Oh, and you can tell in some examples below that, for some reason, when you introduce the dashed underline, the whole string of letters and numbers is slightly lower than the non-underlined copies before it.
Hmm, why does the last colon I made go slightly lower than the two before it? I don't see any changes in sup or span. It's a real mystery to me. Best I can guess is it's some formatting thing in anticipation of dashed underlined text that doesn't always arrive, so not a great explanation.
No longer relevant.
Quick tests:
:456–78Pages 456–78
§5
Quotation: "All that glitters is not gold."
:§§55Pages 456–78
§§55
Quotation: "All that glitters is not gold."
So close... forgot I'd need symbols outside the parameter output!
Okay, I've improved it, but the paragraph symbols are underlined. Are we sure we can't change the style within the first parameter of a tooltip?
For now, maybe it can be repaired just by doing another if statement test or two before the tooltip begins?
Wait, never mind, paragraph symbols were always supposed to be underlined, weren't they! It was only the colon that had to not be underlined.
Also, I've yet to... Oh, no, I just need to test it.
.04.024Pages 456–78
Lines 123–45
DTP identifier: S QS.04.024
Probably works.
Remaining things to do:
Work out the base-select stuff so that para and paras include paragraph symbols.Probably will just require extending the one if statement into three if statements; one for §, one for §§, and one for line, lines, and loc.Eh, if you think about it, why wouldn't notes or commentary be included. Can the parameters themselves not carry that stuff around? Like whatever they were called in actual coding.Maybe another switch statement could help somehow... Yeah, if you give base-select a value, that can output strings with parameters plus surrounding characters in each case. If base-select has no value because the editor didn't use it, it goes down the p-pp-para-paras-loc-line-lines list. I could do that now, but enough "success" has been made.- That worked.
- If the parameter has multiple names, do those other names have to be added in every time that parameter shows up in the code? I would hope just the first time and those are "remembered" in the later occurrences.
- If not, it's like all the incentives want you to include a parameter in the code once and only once, and using one twice is some kind of last resort.
- Fix those excess curly braces around the base-select thing. As far as I can tell they don't break anything, but there must be something wrong with them.
- No need to nest the base-select like I did, I can just include the name of the parameter without curly braces in the case statements in the switch branches.
- Add a
subchapterparameter that would be better forlocuses when it's something like a section rather than a genealogical table or physical part of a book.- But maybe this should not say "Subchapter: Excursus on the languages of Beleriand" or "Subchapter: The new genealogical tables of the Edain", but just the names of the sections, "subchapter" only being used in the code for the editor's benefit/organization.
- Consider something for footnotes. As of now that could go in
locorloc-long. But maybe it could also be something that shows up in the tooltip just as "Footnote" if not empty, or if some default value... but could also show up as "First footnote", "Second footnote", "Footnote to §#"? - Perhaps think about another optional parameter that makes it so information in the base of a tooltip does not reappear in the tooltip (like the page number(s)).
- This is really unnecessary... but could be worth doing for the problem-solving challenge.
- The part that makes me "want it" is seeing an underlined tooltip with a base that's page(s) and the tooltip has the page(s) again and then the location, rather than just the location.
- There are probably ways to simplify what I have that would appear obvious if I understood even a little more of the basics.
- Perhaps a trick would be to put span styling within the output of an if or switch statement without closing it when you'd otherwise think to.
- ...Would it be possible to, in one branch of a switch or if branch, begin a tooltip without ending it, and then end it after the switch or if system is closed, and in the later branches before the end of the switch or if statement (and maybe for a while after the end of the statement) the tooltip is sort of "slid under"?
- Perhaps a trick would be to put span styling within the output of an if or switch statement without closing it when you'd otherwise think to.
- Potential technical problems:
- If a parameter included an equal sign, if that was in a loc or something, would that break it with the switch functions and such?
- Generally: Will it break the site if it were a real template used in pages, or if it replaced the current rp code?
- Would it take too long to calculate, in terms of pages loading I guess?
Tests
default
{{User:Yaulendil/Template/Rp expanded|123}} becomes [11]:123 and should look like [11]:123
p, page
{{User:Yaulendil/Template/Rp expanded|p=123}} becomes [11]:123 and should look like [11]:123
pp, pages
{{User:Yaulendil/Template/Rp expanded|pp=123–45}} becomes [11]:123–45 and should look like [11]:123–45
para, paragraph
{{User:Yaulendil/Template/Rp expanded|para=67}} becomes [11]:§67 and should look like [11]:§67
paras, paragraphs
{{User:Yaulendil/Template/Rp expanded|paras=67–8}} becomes [11]:§§67–8 and should look like [11]:§§67–8
dtp-end, trailing end of DTP address
{{User:Yaulendil/Template/Rp expanded|dtp-end=.01.001}} becomes [12].01.001 and should look like [12]:.01.001
Save a link to a DTP page for later... I'm guessing it would include some Lua thing.
Also, the colon should probably be dropped if doing DTP trailing ends.
Like [12].01.001 instead of [12]:.01.001
Maybe the colon should be rethought for a lot of cases.
Other options could be: [11]123 or [11]p123 or [11]p.123 or [11]p. 123
By the way, what should these numbers be called? DTP addresses? DTP numbers? DTP citations? DTP codes? DTP IDs? DTP identification numbers? DTP references? DTP reference numbers? DTP names? DTP resource names? And maybe replace Cite Tolkien with DTP in those? I don't see an obvious answer to this from the DTP site.
Best answer seems to be DTP references... Kind of unfortunate in distinguishing from TG references, though.
line, from poems/verses
{{User:Yaulendil/Template/Rp expanded|line=1066}} becomes [11]:1066 and should look like [11]:1066
This might also require a "line-loc", like if the common reference is just the entire , and you need to specify what poem the lines are in?
{{User:Yaulendil/Template/Rp expanded|line=1066|line-loc=The Lay of Earendil}} becomes [11]: and should look like [11]:1066The Lay of Earendil, Line 1066
{{User:Yaulendil/Template/Rp expanded|line=1066|line-loc=The Lay of Earendil}} becomes [11]: and should look like [11]:1066Work: The Lay of Earendil
Line: 1066
Trying again with a "base-select" parameter:
{{User:Yaulendil/Template/Rp expanded|line=1066|line-loc=The Lay of Earendil|base-select=line}} becomes [11]:1066Line 1066
Verse location: The Lay of Earendil
and should look like [11]:1066Work: The Lay of Earendil
Line: 1066
That part of the output reappears, so my scheme of putting a parameter into a parameter within the base of a tooltip works. I just haven't gotten rid of the previous parts of the output yet.
Or replace "Work" with "Line location":
{{User:Yaulendil/Template/Rp expanded|line=1066|line-loc=The Lay of Earendil}} becomes [11]: and should look like [11]:1066Line location: The Lay of Earendil
Line: 1066
Needs a better name (within the tooltip text) than "Line location".
Maybe "Verse location"?
Also, maybe it's too misleading to place the line number without the context of a page, unlike paragraphs in Annals of Aman and Grey Annals. Most likely that would mean making a tooltip "necessary" even when the line or lines are alone, like when a quote is alone and so a tooltip box when hovering over "quote" base.
lines, from poems/verses
{{User:Yaulendil/Template/Rp expanded|lines=1066–77}} becomes [11]:1066–77 and should look like [11]:1066–77
loc, at, location
{{User:Yaulendil/Template/Rp expanded|loc=dust jacket}} becomes [11]:dust jacket and should look like [11]:dust jacket
Would it be best to just put Note #, Commentary on §##, in loc, and have the loc in a tooltip within the page ###?
Also, would loc be an appropriate parameter for things like genealogical tables, notes on genealogical tables, or footnotes?
Also perhaps stuff like "Excursus on the languages of Beleriand" within the Grey Annals when it's outside the paragraph numbering and also isn't a note or commentary.
So, loc, or especially loc-2 or loc-long, can include subchapters, sections, genealogical tables, as well as things like dust jackets, covers, spines, insets or whatever you call them.
Wikipedia lowercases these: [11]:dust jacket not [11]:Dust jacket
q, quote or quotation, with page
{{User:Yaulendil/Template/Rp expanded|p=123|q=All that glitters is not gold.}} becomes [11]:123Page 123
Quotation: "All that glitters is not gold."
and should look like [11]:123p. 123
"All that glitters is not gold."
Should maybe have a colon between the p. ### and the <br>, even though Wikipedia doesn't? To keep it consistent with how colons are used to separate the p. ### from a quote in full references.
Well, I forgot how Wikipedia does it anyway, making the above irrelevant.
{{User:Yaulendil/Template/Rp expanded|p=123|q=All that glitters is not gold.}} becomes [11]:123Page 123
Quotation: "All that glitters is not gold."
and should look like [11]:123Page: 123
Quotation: "All that glitters is not gold."
Also, Wikipedia has separate parameters: qp instead of p, qpp instead of pp, qloc instead of loc.
q, quote or quotation, with pages
{{User:Yaulendil/Template/Rp expanded|pp=123–45|q="All that glitters is not gold."}} becomes [11]:123–45Pages 123–45
Quotation: ""All that glitters is not gold.""
and should look like [11]:123–45pp. 123–45
"All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|pp=123–45|q="All that glitters is not gold."}} becomes [11]:123–45Pages 123–45
Quotation: ""All that glitters is not gold.""
and should look like [11]:123–45Pages: 123–45
Quotation: "All that glitters is not gold."
note, with page
{{User:Yaulendil/Template/Rp expanded|p=123|note=8}} becomes [11]:123Page 123
Note 8
and should look like [11]:123Note 8, p. 123
{{User:Yaulendil/Template/Rp expanded|p=123|note=8}} becomes [11]:123Page 123
Note 8
and should look like [11]:123Note 8
Page: 123
note, alone for some reason
{{User:Yaulendil/Template/Rp expanded|note=8}} becomes [11]:n.8 and should look like [11]:Note 8
Could also abbreviate with a tooltip, see comment or commentary alone, in this case maybe like "n.#", with the tooltip having "Note #".
comment or commentary, with page
{{User:Yaulendil/Template/Rp expanded|p=123|comment=67}} becomes [11]:123Page 123
Commentary on §67
and should look like [11]:123Commentary on §67, p. 123
{{User:Yaulendil/Template/Rp expanded|p=123|comment=67}} becomes [11]:123Page 123
Commentary on §67
and should look like [11]:123Commentary on §67
Page: 123
Note to keep it consistent with Template:AA and Template:GA you would need to change this to "Note on §67", rather than "Commentary on".
comment or commentary, alone for some reason
{{User:Yaulendil/Template/Rp expanded|comment=67}} becomes [11]:cmt.Commentary on§67 and should look like [11]:Commentary on §67
Too long. Maybe should be an abbreviation of Commentary, like "Comment. §#", with a tooltip to "Commentary on §#."
line, with page
{{User:Yaulendil/Template/Rp expanded|p=123|line=1066}} becomes [11]:123Page 123
Line 1066
and should look like [11]:123Line 1066 on p. 123
{{User:Yaulendil/Template/Rp expanded|p=123|line=1066}} becomes [11]:123Page 123
Line 1066
and should look like [11]:123Line 1066
Page: 123
q, quote or quotation, with paragraph
{{User:Yaulendil/Template/Rp expanded|para=67|q=All that glitters is not gold.}} becomes [11]:§67§67
Quotation: "All that glitters is not gold."
and should look like [11]:§67§67
"All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|para=67|q=All that glitters is not gold.}} becomes [11]:§67§67
Quotation: "All that glitters is not gold."
and should look like [11]:§67§67
"All that glitters is not gold."
paragraph with page
{{User:Yaulendil/Template/Rp expanded|p=123|para=67}} becomes [11]:123Page 123
§67
and should look like [11]:123§67 on p. 123
{{User:Yaulendil/Template/Rp expanded|p=123|para=67}} becomes [11]:123Page 123
§67
and should look like [11]:123§67
Page: 123
quote with page and paragraph
{{User:Yaulendil/Template/Rp expanded|p=123|para=67|q=All that glitters is not gold.}} becomes [11]:123Page 123
§67
Quotation: "All that glitters is not gold."
and should look like [11]:123§67 on p. 123
"All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|p=123|para=67|q=All that glitters is not gold.}} becomes [11]:123Page 123
§67
Quotation: "All that glitters is not gold."
and should look like [11]:123§67
Page: 123
Quotation: "All that glitters is not gold."
Testing how tooltip handles extremely long strings:
{{User:Yaulendil/Template/Rp expanded|p=123|para=67|q=All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold.}} becomes [11]:123Page 123
§67
Quotation: "All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold."
and should look like [11]:123§67 on p. 123
"All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|p=123|para=67|q=All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold.}} becomes [11]:123Page 123
§67
Quotation: "All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold."
and should look like [11]:123§67
Page: 123
Quotation: "All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold. All that glitters is not gold."
loc with page
{{User:Yaulendil/Template/Rp expanded|p=123|loc=Hador table II, note to Malach}} becomes [11]:123Page 123
Location: Hador table II, note to Malach
and should look like [11]:123Hador table II, note to Malach, p. 123
{{User:Yaulendil/Template/Rp expanded|p=123|loc=Hador table II, note to Malach}} becomes [11]:123Page 123
Location: Hador table II, note to Malach
and should look like [11]:123Location: Hador table II, note to Malach
Page: 123
{{User:Yaulendil/Template/Rp expanded|p=123|loc=XXV Ar-Pharazon}} becomes [11]:123Page 123
Location: XXV Ar-Pharazon
and should look like [11]:123Location: XXV Ar-Pharazon
Could there be a loc and a loc-2 so that you could have something like:
{{User:Yaulendil/Template/Rp expanded|loc=XXV|loc-2=XXV Ar-Pharazon}} becomes [11]:XXV and should look like [11]:XXVLocation: XXV Ar-Pharazon
Or maybe "loc-long".
{{User:Yaulendil/Template/Rp expanded|loc=XXV|loc-long=XXV Ar-Pharazon}} becomes [11]:XXVLocation: XXV Ar-Pharazon
and should look like [11]:XXVLocation: XXV Ar-Pharazon
A unique problem here because both loc and loc-long would be used, because the short loc would be in the underlined "base", but then how do you get the short loc to not reappear in the tooltip just because the loc-long is not null?
Solved the above issue with a nested if statement.
q, quote or quotation, alone?
{{User:Yaulendil/Template/Rp expanded|q=All that glitters is not gold.}} becomes [11]:quoteQuotation: "All that glitters is not gold." and should look like... [11]quote"All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|q=All that glitters is not gold.}} becomes [11]:quoteQuotation: "All that glitters is not gold." and should look like... [11]:quoteQuotation: "All that glitters is not gold."
Just as a fail-safe option I guess?
t, trans, xlat, translation, with page and quote
{{User:Yaulendil/Template/Rp expanded|p=123|q=Mae govannen.|t=Well met.}} becomes [11]:123Page 123
Quotation: "Mae govannen."
Translation: "Well met."
and should look like [11]:123p. 123
"Mae govannen."
"Well met."
{{User:Yaulendil/Template/Rp expanded|p=123|q=Mae govannen.|t=Well met.}} becomes [11]:123Page 123
Quotation: "Mae govannen."
Translation: "Well met."
and should look like [11]:123Page: 123
Quotation: "Mae govannen."
Translation: "Well met."
Wikipedia also has a parameter for the language of the translated quote, language or lang.
How do you get the quote to appear italicized, but only if not English and with a translation? Other than having the editor remember to put in italics in the quote parameter?
Thoughts
Okay, I'll need to figure out how to get it to ask, "if parameter A and parameter B both exist, then do this".
Basically, if there's only one used parameter (and not including quote or any quote stuff, or dtp-end stuff), then there shouldn't be any dashed underline and tooltip. If there is more than one parameter (and at least one of those parameters should be a page or paragraph), there will be a dashed underline and tooltip. You probably can't just put a bunch of triple-brackets next to each other and rely on all the unused ones to be null, there should be an if-statement that either uses a bunch of triple-brackets next to each other in a normal superscript or uses a bunch of them in a dashed-underline superscript and tooltip.
Maybe I can divide parameters into:
- can be used alone
- can be used together with page(s)
- can be used together with paragraph(s), note, or commentary (the three of which probably can't ever be used with each other, mutually exclusive)
- lines of verse could probably be in this category, lines would never be under a paragraph, note or commentary or vice versa, right?
- can be used together with location
- can be used together with quotation
I think it goes like this: If multiple parameters are filled, and one of them is a paragraph(s), the paragraph(s) is the "base", page number and anything else appears in the tooltip. (I could see an argument for prioritizing the page, but it's just up for the editor to only use a paragraph(s) when they've specified the reference to a part, chapter or section which only contains one stretch of paragraphs without restarting at §1.) If there's no paragraph(s), the page(s) is the "base". If no page(s), the loc is the "base". Maybe the line(s) can be the "base" too, but I don't think note or commentary would, those two should be hidden in a tooltip to a page(s) or loc "base". Everything beyond the "base" would be rolled into the tooltip, and the tooltip can repeat what's in the "base" (except if there's a loc-2/loc-long in the tooltip, you wouldn't want the loc/loc-short in there), so it shouldn't be too hard to just make a long block of code that puts whatever is present into the tooltip box sequentially.
Hm, no, probably can't rely on paragraphs always being preferable to prioritize over pages. It makes sense for Annals of Aman and Grey Annals, not so much if it's an L QS chapter and the reader is given a paragraph instead of a page. If you did have to choose one over the other to prioritize generally, you'd probably need an extra parameter that if not null can flip it to the other priority.
{{User:Yaulendil/Template/Rp expanded|123|p=123|para=67|note=8|comment=76|line=1066|line-loc=The Lay of Earendil|loc=XXV|loc-long=XXV Ar-Pharazon|q=All that glitters is not gold}} becomes [11]:123 and should look like [11]§67§67 on Note 8 on Commentary on §76, The Lay of Earendil, Line 1066, [or "Line 1066 on " if no page(s)?] XXV Ar-Pharazon, p. 123:
"All that glitters is not gold."
{{User:Yaulendil/Template/Rp expanded|123|p=123|para=67|note=8|comment=76|line=1066|line-loc=The Lay of Earendil|loc=XXV|loc-long=XXV Ar-Pharazon|q=All that glitters is not gold}} becomes [11]:123 and should look like [11]:§67§67
Note 8
Commentary on §76
Line location: The Lay of Earendil
Line 1066
XXV Ar-Pharazon
Page 123
Quotation: "All that glitters is not gold."
(What makes the above impossible with my latest version is that if an editor ever includes the default value everything else is negated. I think that's a good thing as of now?)
Looking in the tooltip box above, maybe you can have it where all the stuff before the <br> just collapses into nothing if the parameters are null, and the <br> is within the output of the quote parameter? The two different versions of the loc parameter is tricky, though.
Also, the dashed underline should only be under the stuff to the right of the colon, like the page number, not under the colon itself.
- This could be difficult; wouldn't I have to put it into the first parameter of the tooltip, where only the second parameter uses markup?
- :
- I put
<sup class="references" style="margin: 0;line-height: 0.4em; padding-top: 0px !important; font-size: 70%;>:{{tooltip|<span style=border-bottom:1px dashed">123</span>|Commentary on §76, p. 123<br>"All that glitters is not gold."}}</sup>above, but only got the colon.
- I put
- :123Commentary on §76, p. 123
"All that glitters is not gold."- This might work. Only thing is that the colon is no longer a part of the tooltip. I would only care about that in terms of making it as exactly like Wikipedia's as possible.
- :
I'm kind of at a loss how the DTP-ends might coexist with all these. Maybe it makes more sense to have an entirely separate variation of {{rp}} for the DTP-ends.
And the quote parameter should not expect the editor to put it in quotation marks, the quote is outputted in quotation marks.
Is it as intended for the tooltip interactivity to not show up in the Preview box when editing?
A brute method to get what I need might be to have a parameter that's just "base" and the type-specific information is only in the tooltip and you just have to make "base" or "base-u" the same as the type-specific in the tooltip. Could have "base" for the lone not-underlined version (which would be identical to the default parameter) and "base-u" for the underlined base with a tooltip.
Probably my friend will be #switch.
It's also maybe possible I could turn some variations of #if into numbers and that way count how many parameters have been filled (just like whether 2 or more or not?) and use that to switch between different outcomes (like tooltip, non-tooltip, and DTP).
Brief to-do:
- Maybe add a language parameter.
- I can't tell though, since Wikipedia doesn't list examples, if the language appears in the tooltip or something, or if it's just something for internal purposes.
- Imagine a #switch or #if within the tooltip that figures whether a loc-long exists, and if it does, does not include the short loc in the tooltip.
- Imagine a parameter like para-before-p or para-b4-p that if present (with a #if or #switch) makes the paragraph appear in the "base" instead of the page number if both those parameters are filled.
- Include the full DTP address in the more-than-one-named-parameter tooltip; if it's too redundant editors just shouldn't include it with everything else, but the option is there.
Outline for everything, using either nested #if or #switch statements:
- First branch should be the default value, since that's going to be the most commonly used. (But if someone accidentally put in a default value while a bunch more was put in, would you want the named parameters to be accidentally obscured so easily?)
- Have the second branch be the dtp-end (and related parameters like dtp-full to make a link)? Might be a while before it's used by anyone, if ever.
- Should the DTP stuff be relegated to an entirely separate template anyway?
{{rp-dtp}}or{{rpdtp}}or something? - Would you ever want other information to be rolled into a tooltip atop a dtp-end? Or would that be too redundant? I could see maybe a quote in a dtp-end tooltip, if an editor wanted to save a reader finding the specific quote within a long paragraph. It could be a link, a link to DTP if you click on it, a tooltip with the specific quotation (and full DTP address) if you hover over it.
- Should the DTP stuff be relegated to an entirely separate template anyway?
- Third branch perhaps calculates the number of non-null named parameters (besides para-b4-p?), and if the number is 1, outputs a string of all the parameter-outputs in their "solitary" form, with only the 1 non-null parameter appearing.
- I don't actually know if I can "count" this way using just parser functions instead of actual code, I'll have to read more, but I bet I can.
- Fourth branch has a nested conditional to see if a para-b4-p parameter is non-null.
- If para-b4-p is non-null (or y or yes?), then it outputs a paragraph base with the tooltip as I've already figured.
- If para-b4-p is null (or n or no?), it outputs a page base with the tooltip as I've already figured.
- Hm, maybe this para-b4-p could have different outcomes depending on whether its value is para/paragraph, line/lines, loc, or even dtp-end, so you can have potentially any parameter be the base and then have a tooltip filled with whatever parameters you included.
- But would you have to have a separate branch for every base-parameter, or is there a way to just pipe whatever para-b4-p is into the base of one branch, and have the other branch always output page or pages as the branch?
Assuming this would not be good, efficient, or safe enough to put into the {{rp}} template, it could be an alternate version with a name like {{rp-ex}}, {{rpex}}, {{rp ex}}, {{rp-x}}, {{rpx}}, {{rp x}}.
For context, see: User:Yaulendil/Template ideas
Also see this: https://meta.wikimedia.org/wiki/WMDE_Technical_Wishes/Sub-referencing
Maybe should use that as a model instead, since it hopes to replace the Wikipedia {{Rp}}.
Notes
- ↑ See especially, on the 13 February 2025 version of Timeline/Second Age, refs 10 to 16, obscure years in "The Mariner's Wife" that you have to piece together from the text.
- ↑ And, I'm sure, doomed to be overdesigned even if I did understand programming fundamentals, which I don't.
- ↑ To follow the automatic output of cases like
{{AA|12}}and{{GA|12}}. J.R.R. Tolkien, Christopher Tolkien (ed.), Morgoth's Ring, "Part Two. The Annals of Aman": §12, J.R.R. Tolkien, Christopher Tolkien (ed.), The War of the Jewels, "Part One. The Grey Annals": §12. - ↑ But the code for the default parameter is different! I didn't understand the original's so started from scratch.
- ↑ In particular, I'm surprised the site allowed me to nest so many if statements within each other. I read here that wikis limit the number of nestings to seven. Surely I nested more than that? Yeah, there are at least thirteen nested if statements within a switch statement. (Maybe I should add a fourteenth just for luck.) The switch is within a tooltip within a switch within an if statement, so that's fourteen if statements, seventeen statements counting the two switch statements and tooltip. It's possible that this is allowed in the User namespace but won't be allowed in the Template namespace.
- ↑ After further testing, I think the limit is 15 if statements? See in #Description of the code where there are three versions, with 15, 6, and 21 nested if statements each.)
- ↑ Another thing that needs to be determined before I start using it is whether naming conventions and such are appropriate, since changing parameter names afterwards could be very tedious, I figure.
- ↑ It might also be a lot more efficient using an actual coding language, but I decided to stick with pure parser functions.
- ↑ But I can also make another argument, basically that colons can reasonably go between what would have been separated by commas and spaces, but not breaking up titles or words. ""The Grey Annals", "Excursus on the languages of Beleriand"" can become ""The Grey Annals": "Excursus on the languages of Beleriand"", and "The Lord of the Rings, LR 04.04.024" can become "The Lord of the Rings: LR 04.04.024", but you wouldn't turn "The Lord of the Rings" into "The Lord: of the Rings" or "LR 04.04.024" into "LR 04:04.024". (Unless you were converting DTP identifiers into timestamps, or geographical coordinates in some bizarre geocaching event.)
- ↑ I wanted the error message to be red, but I probably won't be able to turn text red within the first parameter of a tooltip, only outside the tooltip template.
- ↑ Meaning everything up to the "How to use" header, not just the above tooltip explainer.
- ↑ It says "Reference" right above here, doesn't it?
References
- ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 J.R.R. Tolkien, Christopher Tolkien (ed.), Morgoth's Ring, "Part Two. The Annals of Aman"
- ↑ 2.0 2.1 J.R.R. Tolkien, Christopher Tolkien (ed.), The Lays of Beleriand, "III. The Lay of Leithian: Canto V (Lúthien's captivity in Doriath)"
- ↑ 3.0 3.1 3.2 3.3
- ↑ 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 LR 4Digital Tolkien Project Citation Systems, The Lord of the Rings, "The Two Towers"
- ↑ 5.0 5.1 5.2 5.3 An Imaginary Book of Real Hungarian Sayings
- ↑ 6.00 6.01 6.02 6.03 6.04 6.05 6.06 6.07 6.08 6.09 6.10 6.11 6.12 6.13 6.14 6.15 6.16 6.17 6.18 6.19 6.20 6.21 6.22 6.23 6.24 6.25 6.26 6.27 6.28 6.29 6.30 6.31 6.32 6.33 6.34 6.35 6.36 6.37 6.38 6.39 6.40 6.41 6.42 6.43 6.44 6.45 6.46 6.47 6.48 6.49 6.50 6.51 6.52 6.53 6.54 6.55 6.56 6.57 6.58 6.59 6.60 6.61 6.62 6.63 6.64 6.65 Michael George Ramer, Howard Green (ed.), The Stone-eaters: A Glacial Romance, Oxford University Press, 2015
- ↑ 7.0 7.1 7.2 HDigital Tolkien Project Citation Systems, The Hobbit
- ↑ 8.0 8.1 (DRP SE.09) Michael George Ramer, Howard Green (ed.), The Stone-eaters: A Glacial Romance, Oxford University Press, 2015, Book II Chapter 9 "Gelasian Spring"
- ↑ Michael George Ramer, Wilfrid Trewin Jeremy (ed.), The Stone-eaters
- ↑ 10.0 10.1 10.2 10.3 10.4 10.5 (SE GM.04) Michael George Ramer, Wilfrid Trewin Jeremy (ed.), The Stone-eaters
- ↑ 11.00 11.01 11.02 11.03 11.04 11.05 11.06 11.07 11.08 11.09 11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 11.19 11.20 11.21 11.22 11.23 11.24 11.25 11.26 11.27 11.28 11.29 11.30 11.31 11.32 11.33 11.34 11.35 11.36 11.37 11.38 11.39 11.40 11.41 11.42 11.43 11.44 11.45 11.46 11.47 11.48 11.49 11.50 11.51 11.52 11.53 11.54 11.55 11.56 11.57 11.58 11.59 11.60 11.61 11.62 11.63 11.64 11.65 11.66 11.67 11.68 11.69 11.70 11.71 11.72 11.73 11.74 11.75 11.76 11.77 11.78 11.79 11.80 11.81 11.82 11.83 11.84 11.85 11.86 11.87 11.88 11.89 11.90 11.91 John Arthurson, Alwin Arundel Lowdham (ed.), Quenta Eldalien
- ↑ 12.0 12.1 12.2 12.3 S QSDigital Tolkien Project Citation Systems, The Silmarillion, "Quenta Silmarillion"