Template talk:R

Cannot do |r= and |a=: at the same time
I am struggling to find a way to both define a citation with and a sub-annotation with. Here's what I've tried:

And here is what I get:

The annotation makes it through unscathed, but the just turns to blank. Is there a workaround somehow? Like, some sort of way to call  beforehand, invisibly? Artoria2e5 🌉 14:06, 31 December 2023 (UTC)
 * I looked at the code in R/ref, and as far as I can tell, it is intended to render either an annotation or a reference, but not both at the same time. There is an #if test for annotation that explicitly does nothing if the parameter has a value; if the parameter is empty or missing, a normal reference is rendered. I think the code would need to be refactored to do what is requested above. – Jonesey95 (talk) 15:05, 31 December 2023 (UTC)
 * Hmmm. I would really want this feature to be a thing; right now I don't see any chance for obvious errors since I am explicitly specifying a and r. Artoria2e5 🌉 09:00, 12 February 2024 (UTC)
 * The current workaround is to use to make an invisible r-only invocation before any annotation invocation is done. --Artoria2e5 🌉 09:10, 12 February 2024 (UTC)

This abomination needs to go
It plays very badly with visual editor and with various tools. For example, I wanted to reformat (convert) citations (missing dates, authors) etc. in Maciej Wąsik. Impossible. Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 01:55, 17 January 2024 (UTC)
 * Why is it impossible? EEng 05:40, 17 January 2024 (UTC)
 * @EEng What I meant is that it is impossible to edit references using this template in the Visual Editor (or, if it is possibloe, I'd like to know how to do it). Right now I can either manually and painstakingly try to convert references to visual editor compatibile simple format in code, or give up on trying to edit the references using that system. Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 14:26, 17 January 2024 (UTC)
 * I looked at the article, and the only thing I can imagine you're having trouble with is WP:List-defined references, and those aren't specific to {r}. EEng 17:37, 17 January 2024 (UTC)
 * Visual Editor is very limited when it comes to interacting with list-defined references, according to this help page and VisualEditor. – Jonesey95 (talk) 14:16, 18 January 2024 (UTC)
 * Those two seem to often be used together. Since VE is the default tool for new editors (and anyone who is not particularly masochistic), we really should think about how to fix this (of course, coding this into VE shouldn't be impossible...). Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 01:29, 19 January 2024 (UTC)
 * I agree that VE ought to be fixed. This is, like, Problem #482 with it. E<b style="color:blue;">Eng</b> 02:26, 19 January 2024 (UTC)
 * I'm a big fan of VE, but I don't think incompatibility is a good reason to say people shouldn't use this referencing system. How about asking at the article talk page if anyone would care if you converted to a different referencing system? Mike Christie (talk - contribs -  library) 17:38, 19 January 2024 (UTC)
 * @Mike Christie Converting is a lot of work, and I do not care much about that article. But what I worry is that increasingly, most people rely on VE, and so articles that use this legacy code are becoming increasingly difficult to fix. I mean, I am a veteran editor, I could fix this article, I don't want to - it is too much hassle (if it used VE compatible code, it would take me one minute, fine; converting would take me 5-20 minutes - no, I am not willing to do this as this is effectively make-up work that should be done with some gadget/button). <sub style="border:1px solid #228B22;padding:1px;">Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 01:59, 20 January 2024 (UTC)
 * That's fair. It might actually be possible to have a bot change it from LDR; if there's no disagreement on the talk page.  I don't think any such bot exists but it's an idea. Mike Christie (talk - contribs -  library) 02:13, 20 January 2024 (UTC)
 * While this needs a VP/RFC, maybe we should have a bot do it for all articles? I don't see what benefits the legacy system has, while the disadvantages (making things hard to fix for VE users, i.e. 99.9% of the new users and growing number of old ones) is clear. <sub style="border:1px solid #228B22;padding:1px;">Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 03:50, 20 January 2024 (UTC)
 * This problem seems like a problem with the just-recently-out-of-beta Visual Editor, not with LDR, but maybe I misunderstand. It seems like the VisualEditor tail is wagging the dog, but if there are other reasons to object to LDR, maybe that style should be re-evaluated. – Jonesey95 (talk) 05:30, 20 January 2024 (UTC)
 * It looks like it should be pretty easy to automate. I'll see if I can put something together in the next day or so to try out on this article. Re the tail wagging the dog: it would be inappropriate to do mass updates unless as Piotrus suggests LDR get deprecated, but a tool to switch easily when there is consensus to do so seems harmless. Mike Christie (talk - contribs -  library) 09:31, 20 January 2024 (UTC)
 * The title of the thread is correct. If this abomination, VE, cannot handle list-defined references, then VE needs to go. If it cannot handle list-defined references, it also cannot handle repeated references, and those are unavoidable. On the other hand, R is just fine for repeated references or other uses of labeled references such as list-defined references, and does not need to go anywhere.
 * As for deprecating list-defined references, I would strongly oppose any such change. Having the references interrupting the body text makes it very very difficult to read the source text for those of us not using this abomination, VE. List-defined references fix that by putting all the references in one convenient place where they can be cleaned up if you are cleaning up references or ignored if you are editing body text. And for long articles with many repeated references, list-defined references make it much easier to find the reference than having them inline somewhere far away in the source. As someone said above, using this abomination VE as an excuse to prevent us from using list-defined references would be the tail wagging the dog. —David Eppstein (talk) 18:07, 22 January 2024 (UTC)

, I have created a script that converts pages written using R to use named references instead. I've tested it on Maciej Wąsik; you can see the converted version here. Can you take a look and see if you can find any problems with the conversion?

It would be fairly easy to change the script to convert in the other direction -- that is, it could take a page using named references and convert it to list-defined references using R.

I think there's a potential for misuse of this script (in contravention of WP:CITEVAR) so I probably should not make it generally available, but if there are pages using LDR and you get no opposition on the talk page to changing the citation style, I can try applying the script. I've only tested it on this one page so far and no doubt there are special cases I haven't considered, so it might not work in all cases. Mike Christie (talk - contribs - library) 22:51, 29 January 2024 (UTC)


 * I for one would strongly object to uses of this script to un-list-define any article I have drafted in list-defined format. And your script conflates two different things: whether the references are list-defined, and whether named references defined elsewhere (regardless of whether elsewhere in the body or elsewhere in a list of refs) are accessed using r or using &lt;ref name=name/&gt;. But I think your script is buggy: it has not converted all the r templates, and as a result it is not true that all references have been moved up to the point of their first use. In your example link, references gov.2023 and gov.briefing have both been moved up to their second use, with the first use left unconverted. —David Eppstein (talk) 23:47, 29 January 2024 (UTC)
 * Yes, I wouldn't apply it unless I saw agreement from editors of that page to do so, or the relevant editors had retired. Thanks for pointing out the bugs -- will have a look at those.  There may be no demand for this anyway, but it was an interesting exercise. Mike Christie (talk - contribs -  library) 23:54, 29 January 2024 (UTC)
 * That bug is now fixed, though no doubt there are more limitations. Mike Christie (talk - contribs - library) 03:14, 30 January 2024 (UTC)
 * @Mike Christie Thanks for the tool. Can you adjust it so it does not move the references to the infobox if possible? VE cannot handle references hidden in templates.
 * In other news, it is ridcolous VE still cannot do it. Anyone knows which bugzilla tracks this? WMF has money to give away to unrelated projects by other NGOs but not for finishing VE. Ridcolous. <sub style="border:1px solid #228B22;padding:1px;">Piotr Konieczny aka Prokonsul Piotrus&#124; reply here 02:16, 2 February 2024 (UTC)
 * It would be possible to move the refs out of the inbox with a script, but I think that should be a separate function -- I'd rather not combine it with this. In some cases it wouldn't work anyway as the only instance of a reference might be within the infobox.  And I think it's more general than just infoboxes; if a ref tag only occurs within a note tag I think those are also invisible to VE.  There are certainly Phab reports on the issue; if I recall correctly it's a bigger development effort than it appears. , do you recall the status on this?  I know you've been repeatedly asked about this over the years and I thought you might have the inside information. Mike Christie (talk - contribs -  library) 02:26, 2 February 2024 (UTC)
 * It seems likely to me that the same thing that prevents VE from seeing references in iboxes is the thing that prevents it from seeing them in reflists. See my earlier comments about "this abomination, VE": we should not let its limitations push us into worsening editing for the rest of us who avoid it, by making the source code of our articles unreadable. —David Eppstein (talk) 03:08, 2 February 2024 (UTC)
 * Mike, it's called "rich editing of templates", and it is a h-u-g-e project. I believe that it's currently blocked on the parser unification (and, you know, deciding to have a development team spend a couple of years on it instead of, say, the mobile visual editor).
 * @Piotrus, if this particular template (Template:R) is the same as the one used years ago at the Polish Wikipedia, then @Tar Lócesilion will know what's involved in converting.  WhatamIdoing (talk) 07:13, 2 February 2024 (UTC)
 * If the issues are what I think they are, then r is not the problem. The problem is VE + list-defined references and you would have exactly the same problem regardless of whether you used X or &lt;ref name=X/&gt; to access those list-defined references. You could test this by trying to use VE to edit a named reference defined elsewhere in the body (not list-defined) and comparing its behavior for X vs &lt;ref name=X/&gt;. —David Eppstein (talk) 07:21, 2 February 2024 (UTC)
 * I finally filed a bug at phabricator about the VisualEditor and list-defined references here: https://phabricator.wikimedia.org/T356471
 * As the help page linked above says: "You can edit existing list-defined references in VisualEditor. You cannot add or remove list-defined references. It also does not support modifying list-defined references inside reflist, only &lt;references/>."
 * The VisualEditor struggles with the r template's named references because they are defined within a template. If named references are defined like  within the body text, then the VisualEditor does fine. If you ever come across pages with reference names like ":2" those are the default names created when the VisualEditor creates named references. Hope that helps,  Rjjiii  (talk) 03:58, 9 February 2024 (UTC)
 * It is not actually a necessary part of using r that its references be defined within a template. They could be defined as above within body text. Or you could wrap them inside &lt;references&gt; ... &lt;/references&gt; at the end of the article instead of using the reflist template to do that for you. Maybe it is reflist that we should be pushing to eliminate in favor of &lt;references&gt; so that VE works better? Only now I see in the phab bug and its test case that this abomination VE does not even work with list-defined references using &lt;references&gt;. —David Eppstein (talk) 05:57, 9 February 2024 (UTC)

Should I use or  ?
I was reading the article about Swatting and I discovered an  reference named "Krebs_1" with a page number and a tool tip. This was my first time seeing that. I thought there was an error with the reference, so I looked at the source and noticed that there was a quote but when I hovered over the reference, the quote did not show. It did not occur to me to hover over the page number to see the quote in the tool tip. I also noticed that this quote did not display in the references section like a  quote does so I could not read it there either. The only place to read the quote was hovering over the page number, which in this case was unnecessary because the reference was a single short web page and not a book with multiple pages. Maybe I shouldn't have but I changed the reference to the  format and moved it from the references section. I changed the format of the reference so that the quote would be appended to the citation instead of displayed as a tool tip. It may have been an unnecessary edit but I worry that other Wikipedia readers might not understand that if you hover over the page number there might be a tool tip. This was not at all obvious to me.

Also, the tool tip text is much smaller and more difficult to read than the text in the citation.

So, the main reason I am creating this topic is to find out which reference system I should use when working with references? Most of the edits that I do are fixing dead links and adding archived pages and in general fixing references as I read Wikipedia. For my future edits would it be preferred to use the  template format or the   format or does it matter? Also, on my first edit of the Swatting page in the references section, I removed  and replaced it with   after I moved the reference out of the references section. However, I was unsure of the differences between  and   so I changed it back. What is the difference? I noticed that there was another  reference in the source and it still displayed correctly in the references section when I used   instead. Also, I don't use an editor, I edit the source directly. -- Ubh [ talk... contribs... ] 15:03, 7 March 2024 (UTC)
 * The reflist template permits overriding the defaults on, but if you're not using those parameters it's supposed to be identical.  I believe there is a slight difference in rendering on mobile. It also used to be the case that using   was better for editors using the Visual Editor, but VE now copes with reflist so that's no longer an issue.  I typically use  .  For r vs. tags, as a VE user myself I find the ref tags much easier to work with, and as r is not widely used I would not suggest you adopt it unless it has some specific benefits you like.  If you're editing an article that has an established citation style, though, you should try to stick with that, per WP:CITEVAR.  Otherwise if you use VE it will put in ref tags by default.  If you don't use VE, I would suggest using whatever you find easiest -- ref tags, sfn, or one of the other systems out there. Mike Christie (talk - contribs -  library) 15:57, 7 March 2024 (UTC)

Ranges of pages with hyphens?
It is unclear what markup to use for a range of pages when the page numbers contain hyphens. Which of these is correct for p1-s1 through p2-s2 It would be helpful to have bothdirection and examples of proper usage for this case. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 03:25, 17 June 2024 (UTC)
 * p1-s1-p2-s2
 * ((p1-s1))-((p2-s2))
 * pp