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: 5 hours 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 |details= the default for this template rather than tacking on additional lines to the reference using |follow=. The only regression involved with moving to sub-referencing as default is that it is not compatible with nested citations, but as of now there are only a small handfull of pages using that feature, and the feature 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