Jump to content

Template talk:R

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:R)
Latest comment: 1 day ago by Ahecht in topic Make subreferencing the default

Easy ready enhancement - Display quotation when no locator is supplied

[edit]

Display a small dagger (†) when {{r}} has a quotation but no page, pages, or location parameter/ Currently, the quotation is present but has no visible tooltip target.

I made a proof of concept at User:Very Polite Person/draft/Template:Rqi, demonstrated at User:Very Polite Person/sandbox. Existing output is unchanged; the dagger appears only when a quotation is supplied without a locator.

See here and mouse over the dagger symbol with dotted underscore: https://en.wikipedia.org/w/index.php?title=User:Very_Polite_Person/sandbox&oldid=1364282264

This was done by changing this:

|location{{#if:{{{location1|{{{location|{{{loc1|{{{1loc|{{{loc|{{{at1|{{{at|}}}}}}}}}}}}}}}}}}}}}||NULL}}={{{location1|{{{location|{{{loc1|{{{1loc|{{{loc|{{{at1|{{{at|}}}}}}}}}}}}}}}}}}}}}

To:

|location{{#if:{{#if:{{{location1|{{{location|{{{loc1|{{{1loc|{{{loc|{{{at1|{{{at|}}}}}}}}}}}}}}}}}}}}}|x|{{#if:{{{page1|{{{page|{{{p1|{{{1p|{{{p|}}}}}}}}}}}}}}}{{{pages1|{{{pages|{{{pp1|{{{1pp|{{{pp|}}}}}}}}}}}}}}}||{{#if:{{{quotation1|{{{quotation|{{{quote1|{{{quote|{{{q1|{{{q|}}}}}}}}}}}}}}}}}}|x}}}}}}||NULL}}={{#if:{{{location1|{{{location|{{{loc1|{{{1loc|{{{loc|{{{at1|{{{at|}}}}}}}}}}}}}}}}}}}}}|{{{location1|{{{location|{{{loc1|{{{1loc|{{{loc|{{{at1|{{{at|}}}}}}}}}}}}}}}}}}}}}|{{#if:{{{page1|{{{page|{{{p1|{{{1p|{{{p|}}}}}}}}}}}}}}}{{{pages1|{{{pages|{{{pp1|{{{1pp|{{{pp|}}}}}}}}}}}}}}}||{{#if:{{{quotation1|{{{quotation|{{{quote1|{{{quote|{{{q1|{{{q|}}}}}}}}}}}}}}}}}}|†}}}}}}

This would allow this template to then display quotes ad hoc, inline, on any reference usage - and for good measure, it'll be the easiest way to use/deploy quotes for in-line usage like this. — Very Polite Person (talk/contribs) 17:21, 15 July 2026 (UTC)Reply

Why would you use r when there is no page, pages, or location parameter? If you're using it with cs1 just put the quote in quote= PARAKANYAA (talk) 21:32, 15 July 2026 (UTC)Reply
I've been in the habit of trying to keep the same uniform style within articles I'm doing, and r is pretty great for simple reuse of named refs (list defined) and assigning snippets of quotes inline (see Amanda Jones (inventor). I put up a mock edit here:
https://en.wikipedia.org/w/index.php?title=Amanda_Jones_(inventor)&diff=next&oldid=1364313524
Of what it could look like to do this with a site that has no page identifiers. This would let you use a website article, say, any number of times, and each usage could have it's own unique in-line quote value. Beats using rp, ref combos and other stuff--keeps it all in the r wrapper with this one change. — Very Polite Person (talk/contribs) 21:38, 15 July 2026 (UTC)Reply
I think that that is massive, massive overkill and I'd oppose adding that. PARAKANYAA (talk) 21:47, 15 July 2026 (UTC)Reply
The ability to have unique quotes inline against a single URL source is overkill? Or because of using r? That's basically all I was after, that specific use case. — Very Polite Person (talk/contribs) 21:49, 15 July 2026 (UTC)Reply
@PARAKANYAA, Very Polite Person: Yes, if anything the template should be modified to emit an error when used with a quote but without a location or page. For a website article, you could use something like the {{r|RefName|at=para. 7}} example given in the documentation, but the citation format used by this template is confusing enough without introducing seemingly meaningless notation such as 1:† into the mix. Hopefully this whole mess goes away when meta:WMDE Technical Wishes/Sub-referencing is enabled and we can refactor this template to use that format instead. --Ahecht (TALK
PAGE
)
21:46, 15 July 2026 (UTC)Reply
The answer to “why” is clearly because it’s a better faster easier system than re-writing HTML code for every use of a reference. And for example it doesn’t need quote marks for a multi-word-with-a-space ref name. Clearly in the case of a WEB citation for example, to an typical article, there’s no such thing as page or location.
It makes no sense to me that r can’t simply show a quote if a person just enters a quote=. It’s failing to function in the most obvious expected way, which is that the quote field should work just like in an html reference, yet it doesn’t.RandomEditor6772314 (talk) 14:16, 6 October 2026 (UTC)Reply

I would advise against using quotes in {{r}} (regardless of the page number) due to accessibility issues. @Quiddity already mentioned some issues a few years ago (issues for screenreaders and discoverability problems – how many readers will realize that they can hover over the page number to see details like a quote?). The tooltip also doesn't seem to work on mobile devices which means the majority of readers cannot access it at all. --Johannnes89 (talk) 09:33, 19 July 2026 (UTC)Reply

well, shit. Back to formula. — Very Polite Person (talk/contribs) 14:16, 20 July 2026 (UTC)Reply
I suppose I need to bite the bullet and start doing sfn/sfnq like this then... https://en.wikipedia.org/w/index.php?title=Historiography_of_science&oldid=1357780379#cite_note-12
R was just so visually simple/intuitive and the compactness as a view is delightful, but that's the price, I suppose. — Very Polite Person (talk/contribs) 15:15, 20 July 2026 (UTC)Reply
It seems to me that the problem can be fixed, where R should display quotes regardless of location? Web sources don’t have locations or pages anyway. Why doesn’t R handle and display quote exactly like HTML ref code, regardless of page location?RandomEditor6772314 (talk) 14:46, 6 October 2026 (UTC)Reply
@Johannnes89, @Mathglot, @PARAKANYAA, @Very Polite Person: This template now supports subreferencing by setting |style=sub. This is mobile-friendly, since clicking on the citation pops up the parent citation plus the quote, and it can handle quotes without a location. See User:Ahecht/sandbox8 for a demo. --Ahecht (TALK
PAGE
)
15:17, 14 October 2026 (UTC)Reply

Suggest deprecating quote parameter due to inaccessibility

[edit]

If |q= is used, it's displayed as a tooltip. This is inaccessible on mobile which has no concept of hovering, meaning more than half of our readers can't see this content. It should be deprecated in favour of solutions that preserve the quotation in ordinary text, such as <ref>...</ref> with {{harvnb}} followed by the quotation. Hairy Dude (talk) 14:21, 24 August 2026 (UTC)Reply

Can't we just modify R to be more functional under the hood? It would seem more prudent than potentially having to update however many articles using the quote function. — Very Polite Person (talk/contribs) 15:49, 24 August 2026 (UTC)Reply
@Hairy Dude, Very Polite Person: This could be solved if we implement sub-referencing with this template once that feature is rolled out on the English Wikipedia. You can get an idea of what that would look like at https://en.wikipedia.beta.wmcloud.org/wiki/Template:R/testcases --Ahecht (TALK
PAGE
)
19:38, 21 September 2026 (UTC)Reply
Yes, I agree with you completely. I’m baffled that multiple people seem to not imagine that r should be able to do quotes handled exactly as HTML ref code, yet it doesn’t. And for example, web citation for typical web article has no pages or locations.
It makes no sense that a non-located quote is just ignored (either in some cases or all the time? I don’t even know). I’m here because my quote in an r just failed to appear, and it’s a web source so there’s no “location”.RandomEditor6772314 (talk) 14:18, 6 October 2026 (UTC)Reply
@RandomEditor6772314 There is a location, even if there's not a page. You can use paragraph number, section heading, etc. --Ahecht (TALK
PAGE
)
17:54, 7 October 2026 (UTC)Reply
@Hairy Dude, RandomEditor6772314: The template now supports subreferencing by setting |style=sub. This is mobile-friendly, since clicking on the citation pops up the parent citation plus the quote, and it can handle quotes without a location. See User:Ahecht/sandbox8 for a demo. --Ahecht (TALK
PAGE
)
15:15, 14 October 2026 (UTC)Reply
Thanks. Incidentally I see that the warning message referring to Parsoid contains a spelling error ("preceeding"). Hairy Dude (talk) 12:40, 28 October 2026 (UTC)Reply
Fixed. – Jonesey95 (talk) 12:58, 28 October 2026 (UTC)Reply

Lua implementation

[edit]

I've created a Lua implementation of this template at Module:R, and implemented it at Template:R/sandbox. The module will also implement {{R/ref}}, {{R/where}}, {{R/langcode}}, and {{R/superscript}}. Switching to this will have a bunch of advantages, including easier to read and maintain code, reduced post-expand include size, and an unlimited number of references per template call instead of just 9. It will also allow for increased flexibility if we use this template to implement sub-referencing, as I've done in Module:R/sandbox.

This is a pretty complex template with lots and lots of uses and therefore strange edge cases, so I'd appreciate any help in testing and debugging the Lua module. I've tried to incorporate all the quirks of the current template as faithfully as possible, but it's very likely there's stuff I missed. --Ahecht (TALK
PAGE
)
19:36, 21 September 2026 (UTC)Reply

With no objections, I've started the transition with {{R/where}}. I'll keep moving over the subtemplates slowly unless someone complains that it broke something. --Ahecht (TALK
PAGE
)
19:25, 29 September 2026 (UTC)Reply
I've now moved over {{R/superscript}} to the module. --Ahecht (TALK
PAGE
)
14:35, 1 October 2026 (UTC)Reply
I've moved over {{R/langcode}}. --Ahecht (TALK
PAGE
)
18:59, 5 October 2026 (UTC)Reply
I've moved over {{R/ref}}. --Ahecht (TALK
PAGE
)
15:03, 6 October 2026 (UTC)Reply
Happy subreferencing day! The main {{R}} template was moved over to the Lua module yesterday, and the sub-referencing version was copied over today. You can now do subreferencing by using |style=sub. --Ahecht (TALK
PAGE
)
14:58, 14 October 2026 (UTC)Reply

“curved quotes are disfavored” is unclear useless phrasing, but I can’t fix because page is locked

[edit]

The confusing meaningless phrase “curved quotes are disfavored” should say curved quote marks. A “quote” is not the same as a punctuation mark. (Regardless of whether people verbally say “quote” as a short form of “quotation mark.”) I had no idea what it meant.

I fix terrible phrasing on Wikipedia all the time, but the page is locked, so I can’t.RandomEditor6772314 (talk) 14:11, 6 October 2026 (UTC)Reply

@RandomEditor6772314 I'm not sure why we talk about quotation mark styles at all because they are added automatically by the template. I replaced that entire sentence. --Ahecht (TALK
PAGE
)
15:08, 6 October 2026 (UTC)Reply

Make subreferencing the default

[edit]

Now that we've had a couple weeks to get used to sub-referencing, I'd like the open the conversation on if/when we make using this style the default for {{R}} (e.g. using details="" instead of tacking on additional lines to the reference using using follow=""). The only regression involved with moving to sub-referencing as default is that it is not compatible with nested citations and bulleted lists in quotes or annotations (bulleted lists work in the reference itself), but as of now there are only a small handfull of pages using those, and they would still be available by specifying |style=ama or the current style (open to name suggestions for that -- |style=sup, :, follow, location, etc). The module could even be written to automatically switch to the old style if it detects nested references (again, open to suggestions). --Ahecht (TALK
PAGE
)
17:51, 29 October 2026 (UTC)Reply

Since I already listed the downsides of switching, I thought I'd summarize some of the downsides of the current template that would be solved by switching to sub-referencing:
  • Eliminates cryptic notation and visual clutter. As editors have noted is discussions like this, this, and this, the {{rp}}-style page numbers (e.g. [12]:345 or [6]:7-8–7-9) are confusing as it's not immediately obvious what they represent, and they go against the standard everywhere else on Wikipedia that citations are only a reference to a footnote or bibliography entry and do not contain any actual data (this goes back to the deprecation of parenthetical citations in 2020). Sub-referencing just adds an additional citation reference (e.g. [1.1] or [1.2]), which links to the full citation and is compatible with Navigation popups, Reference Tooltips, Reference Previews, and the MobileFrontend Reference pop-up drawer for viewing the full citation.
  • Improves accessibility. The common answer to the concerns about cryptic notation is that hovering over the citation explains that the extra number refers to a page number, but that is not accessible for mobile readers who make up 2/3 of Wikipedia traffic. The hack (that I admittedly was responsible for) of including quotes in the hover text also fails on accessibility grounds. This has been discussed here and here, among other places. Sub-referencing is fully supported by MobielFrontend and the Minerva skin used on the mobile website, and sub-references show up in the pop-up reference drawer on mobile.
  • Allows more flexibility. Unlike with the current template, quotes can be added without a page number (as requested here), and information can appear both in a tooltip and in the references section without resorting to hacks such as |a=p or |a=q.
  • Restores the ability to have numbered lists of annotations under a reference. This used to work by starting the annotation with #, but was broken by the switch to parsoid. This was aften used alongside complex notation such as {{r|n=C1|p=23|a=#[[#L1|^]] p. 23: Quotation from page 23. |link-id=L1}} to allow backlinks from sub-annotations to the article text where they were referenced, but that would now be handled automatically with sub-referencing just by doing {{r|n=C1|p=23|q=Quotation from page 23.}}
--Ahecht (TALK
PAGE
)
15:39, 9 November 2026 (UTC)Reply
Hi. Could you clarify if your proposal is a minor technical change associated with this template use or you are proposing something that will cause editors to change referencing style? Johnjbarton (talk) 17:39, 9 November 2026 (UTC)Reply
@Johnjbarton It would be a change in the appearance and behavior of the references for readers, but would not require editors to make any changes from their end. --Ahecht (TALK
PAGE
)
18:55, 9 November 2026 (UTC)Reply
Changing the reference style for readers, automatically, without an established consensus to deprecate the previous style, would appear to violate WP:CITEVAR. —David Eppstein (talk) 19:13, 9 November 2026 (UTC)Reply
WP:CITEVAR was written to avoid people running through articles en-masse clogging up the edit histories by flipping articles between CS1 and CS2 citation formats. That doesn't really apply here, since the change is done on the backend. CITEVAR also only prohibits changes based on personal preference, not changes based on consensus. --Ahecht (TALK
PAGE
)
22:11, 9 November 2026 (UTC)Reply
It certainly would apply to articles where the post-footnote details were sometimes included with {{r}} and sometimes with {{rp}}. Then any change to this template would make the formatting inconsistent. —David Eppstein (talk) 22:44, 9 November 2026 (UTC)Reply
@David Eppstein Fair enough. We could make the template default to the current format if the style is left blank and it detects that [1] is currently on the page. --Ahecht (TALK
PAGE
)
15:21, 10 November 2026 (UTC)Reply
I'm confused. I thought I would take a look at some examples, but History of the violin uses a mishmash of styles and does not match https://meta.wikimedia.org/wiki/Special:MyLanguage/WMDE%20Technical%20Wishes/Sub-referencing. I am specifically looking for an example on English Wikipedia to see how the popups work. Johnjbarton (talk) 20:42, 9 November 2026 (UTC)Reply
What exactly is being done at History of the violin, when I try to go back up from the references under reference #9 (the one starting "p. 62, n. 24:...") the up arrow doesn't work. The one under reference #7 is also broken.
Or have misunderstood completely is the secondary note meant to apply to both insurance ances of reference #9, the formatting makes it very unclear what exactly the subnote is meant to apply to. -- LCU ActivelyDisinterested «@» °∆t° 20:57, 9 November 2026 (UTC)Reply
@ActivelyDisinterested, Johnjbarton: History of the violin does not use the new sub-referencing style. It uses the existing style that this proposal would replace. That article is also one of the articles that wouldn't work with the proposed sub-referencing style because it contains nested citations -- either we would modify it and pages like it to force the old style, or have the module fall back automatically in cases like that. You can see the new sub-referencing style in action in articles like PHP2Shell, although that article uses the {{subref}} template instead of {{r}}.
The up arrow link not working was a separate bug that I just fixed, but it's still a bit of a hack that would be unnecessary with sub-referencing. --Ahecht (TALK
PAGE
)
22:03, 9 November 2026 (UTC)Reply
Seeing the examples in PHP2Shell the new subreferencing would fix everything I saw as being wrong in History of the violin. Combined with the easier template formatting it's a great improvement. -- LCU ActivelyDisinterested «@» °∆t° 22:08, 9 November 2026 (UTC)Reply
Ok, thanks. I assume that the Collier subref is not representative, but otherwise the technique looks good enough to me. Johnjbarton (talk) 23:37, 9 November 2026 (UTC)Reply

References

  1. ↑ Cite error: There are <ref> tags on this page without content in them (see the help page).