Jump to content

User talk:Nardog/RefRenamer

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Questions/suggestions

[edit]

Wow, this is really great! I have some suggestions and some questions. This is a really thoughtful, comprehensive, and well-designed interface, that goes well beyond what I had contemplated when I made the request at Wikipedia:User scripts/Requests#Script to convert numeric ref names created by VE into standard names.

I don't think you went overboard on options, they are greatly appreciated! (And I even have one or two more, below.) But the number of options does mean that it takes a moment to take it all in, and it's not clear what they all are at first glance. What I'd love to see, ideally, is a well-sectioned /doc page (User:Nardog/RefRenamer/doc?) that goes with it, and has some explanations there. Since you did all the hard work of actually creating the script, I'll volunteer to fill in as much of the /doc as I'm able, but I didn't want to make the presumption of creating it now, since this is your baby, and I will follow your lead. But if you turn that red link blue, I'll do what I can. As a second step, I'd love to see the script contain a few judiciously-placed superscript help links, that link to the proper section of the /doc page; perhaps these could be tooltips that give brief help right away, with further help at the /doc page, when the tooltip pop-up is insufficient. The link itself could be a question mark icon, like (or pick one from c:question mark icon) or one of those superscript[Why?] or[What is this?] links.

At the risk of wearing out my welcome, here are some possible suggestions for improvement (unordered list; numbered to make reply-by-number easier):

  1. Improve the default edit summary, to: "Renamed [[WP:VE|VE]] numeric ref tags with RefRenamer"
  2. Possible new check box: Replace [most common] Latin-extended accented letters (à ç è é í ï ò ó ö ß ú ü À É È Í Ï Ó Ò Ú Ü) with unaccented letters (so that later editors reusing the ref by name can type it on their Qwerty kbd); see {{remove accents}}
  3. Are the candidate changes applied all-or-nothing? What if there are 20 rows identified, and they don't want to apply the changes for ":9" and ":27" for some reason; can they disable changes for only those two?
  4. Not sure what "(Remove)" does if I check it. Tooltip would probably suffice for this.
  5. Didn't realize at first that I could overtype the "New name" column values; tooltip/link would help.
  6. Can you name the table something? I'm thinking "candidate changes" or something; or leave it nameless, and add a help caption above: "Refs in the article named in col 1 will be changed to the new name in col 2, if you hit continue" or some such
  7. Tooltip/links on 'Apply' and 'Continue; I was a little scared to press but figured I could self-revert if it did change-and-publist all at once
  8. I found "increment starts at" opaque, until I saw something about it on the script page. This would be a good place for a question-icon plus tooltip link.
    • Apply: – "Regenerate candidate changes box; you will have the opportunity to review this."
    • Continue: – an explanatory message, that tells that what will happen if they click it. [[Continue |Continue]]
  9. alphabetize "Other ref-names box" (not case sensitive), so if I override a refname in the Candidates box "New name" column, I can make sure there's no collision with already existing names. (This is not too rare, and occurs when Jones has more than one publication in YYYY.) (Extra credit: evaluate collisions, either on the fly, or when 'Apply' button is pressed, and show an alert. Otherwise, just a help tip over "New name" col. reminding them to double-check against "Other ref names" if they change anything.)

Can't tell you how much I appreciate this script; this is going to be *so* helpful. Thanks a million for this! Mathglot (talk) 03:04, 9 February 2023 (UTC)[reply]

You can keep the original ref name by leaving the textbox empty. So for an unreused name, you can uncheck the checkbox to remove the name attribute entirely, check it and leave the textbox blank to do nothing to it, or fill a replacement in. The increment already takes the other (non-VE) ref names into account. So if a reference named "Jones-1999" already exists, the first reference to Jones 1999 in the list will be "Jones-1999-2", and the second "Jones-1999-3", and so on (with the default options). That's the whole point of the feature.
Added "Remove diacritics". I'd thought of it too and decided against it because it's often conventional to use a digraph instead of just removing the diacritic to represent a letter with a diacritic in ASCII (e.g. oe for ⟨ö/ø⟩, aa for ⟨å⟩), which varies by language, but in that case the user can correct it after the fact now that I think about it. Alphabetization of other ref names: good idea, done. Also underscores are now replaced by spaces in that box. The default summary is now "Replaced VE ref names with RefRenamer". It's not the tags that are numeric so "numeric ref tags" doesn't make sense. And I want it to be short and to the point because I hate long boilerplate summaries, which I find numbing rather than informative. Linking directly to Wikipedia:VisualEditor/Named references should be more helpful.
To be honest, I don't want the interface to be too user-friendly or bloated with instructions. I want only users to be editors who know what they're doing, as this is about a cosmetic issue. The script itself doesn't submit an edit on the user's behalf, so they should be able to poke around and figure stuff out. Nardog (talk) 09:04, 9 February 2023 (UTC)[reply]
The Usage section is the place for documentation. I'll try and improve it based on your feedback. Nardog (talk) 09:22, 9 February 2023 (UTC)[reply]
That sounds great, and thank you. I do take your point about "not too easy", and you've persuaded me on that point. My first encounter did make me pause and look around, which I now reinterpret as a good thing; making them/me think about what it is and why it's there (and conceivably scaring off some newbies, or some who can't be bothered) also seems like a good thing; this leaves the use of it to those willing to put in the effort; good call, I think.
About the increment: when I first faced this issue many moons ago, I copied from what seemed like other, well-constructed pages that had already resolved this; I saw a lot of Jones-1996a, Jones-1996b and so on, and I copied that style and have used it ever sincce. Wasn't sure if I can just put an "a" in the increment field; I suspect not, because I think of "increment" as numeric only. If I can do that, then maybe label it "uniqueness" instead of increment. If not, that would be one feature I would take advantage of on occasion; but it looks like I can already do it manually using the overtype method, and as it's a pretty infrequent case anyway, I'm not sure if it's worth bothering about. This is really a super-useful tool; thanks once again, really really well done. Mathglot (talk) 19:25, 9 February 2023 (UTC) P.S., for the summary, consider changing the with to using; upon first glance replace with is slightly ambiguous. Ta, Mathglot (talk) 19:28, 9 February 2023 (UTC)[reply]

About publicizing this

[edit]

This deserves wider publication, and I'd like to see it announced at WP:VPM, or some other centralized forum of your choice, but wanted to check with you first, in case you prefer to hold off for some reason. I'd be more than happy to do the honors, if you prefer. Mathglot (talk) 04:01, 9 February 2023 (UTC)[reply]

The talk page for Visual Editor also comes to mind. And of course the standard user script advertising places: WP:US/L, WP:Scripts++/Next, script/resource pages of relevant WikiProjects, etc. –Novem Linguae (talk) 04:09, 9 February 2023 (UTC)[reply]
Fine as long as you link to User:Nardog/RefRenamer (so they see the warning). Nardog (talk) 11:11, 9 February 2023 (UTC)[reply]
  • This sounds a wonderful script, thank you, @Nardog: for creating it. I've come here after getting an email alert from Mathglot via Phabricator, as someone who has asked for VE not to create such awful reference "names".
But I wonder about the protocol here. Will it be considered acceptable to use it on articles created by another editor? It would be great to get a clear agreement somewhere that these human-friendly ref names are agreed to be an improvement over those created by VE, so that changing them is always considered an improvement and not something where the original editor can argue for the retention of their original "choice" of name for the references. I never use VE myself, so any time I could use this script would always be on an article someone else had created. What do you think? PamD 21:54, 9 February 2023 (UTC)[reply]
@PamD:, Not an issue; the numeric references are never chosen by any editor, they are chosen programmatically, and they are awful. VE users don't create these names, and because of the nature of the VE interface, they are not aware that they are there. There is general agreement that this is a serious flaw in VE, has topped Community Wishlist surveys for years (since 2015 or before, iirc; here's 2017), and is tracked in phab:T92432 and half a dozen other related tickets. People have been howling over this problem for years in multiple forums, and I've never once seen anyone support keeping a numeric, auto-generated VE ref name. This script is a godsend for countless users, and there is no downside that I can see. Mathglot (talk) 23:01, 9 February 2023 (UTC)[reply]
I guess more to the point, perhaps, is that it's kind of like asking if I can edit an article created by another user, maybe changing all their content around, or deleting and replacing it. Of course I can; this is a wiki. It's hard to imagine how ref names auto-generated on behalf of another editor could in any way be considered sacrosanct, when the content isn't. Mathglot (talk) 23:13, 9 February 2023 (UTC)[reply]
@Mathglot: Certainly, and I'm one of those who's been howling for change - I just worried that some idiotic editor might cry that it was needlessly changing their citation style, which is something one's not supposed to do! It's near the things described in Wikipedia:Citing_sources#To_be_avoided: perhaps fixing VE's ghastly reference names needs to be added explicitly to the next section, Wikipedia:Citing_sources#Generally_considered_helpful, just to pre-empt any such objections? PamD 23:55, 9 February 2023 (UTC)[reply]
@PamD: good point; I've made this edit at Wikipedia:Citing_sources; let's see if it sticks. Mathglot (talk) 00:08, 10 February 2023 (UTC)[reply]
@Mathglot Looks good, thanks. I look forward to trying out the script. But let's hope VE eventually gets fixed so it no longer creates these abominations. PamD 06:30, 10 February 2023 (UTC)[reply]
Listed at: Wikipedia talk:User scripts, Wikipedia:User scripts/List, Wikipedia:Scripts++/Next, WP:VPM, Wikipedia talk:VisualEditor, phab:T92432, WP:ENB, WT:MED. Novem Linguae, I didn't find any obvious WikiProjects (interestingly, VE does not have one) but I did add it to the Wiki Education Noticeboard, and to the MED project, where I think it will be well received. Mathglot (talk) 23:15, 9 February 2023 (UTC)[reply]
@Mathglot, looks like you have scoured heaven and earth to find places to mention this script. Feel free to advertise any of my user scripts as well as you have Nardog's. /joke. hehe :) But anyway, nice job, and I am happy that you are getting the word out about a great script. –Novem Linguae (talk) 23:31, 9 February 2023 (UTC)[reply]
User:Novem Linguae, hmm, maybe we can work out a deal. I'll trade you that, for some new entries here. Just lmk when you're ready to cash in your chips, and I'll get busy on those notifications... Mathglot (talk) 23:37, 9 February 2023 (UTC)[reply]

 You are invited to join the discussion at meta:Community Wishlist Survey 2023/Editing/VisualEditor should use proper names for references. –Novem Linguae (talk) 21:40, 10 February 2023 (UTC)[reply]

Poss bug: only one ref out of 80 rows applied to Diff

[edit]

The script generated 80 rows for RBM10, but when I got to the Diff, only one ref was applied ("Johnston-2010"). Reproducible in three browsers. Details below; copy of script-generated Diff page here; diff that with RBM10 rev. 1079530668: DIFF.

Options and conditions to reproduce

RefRenamer version: ??? (runtime: approx. 2023-02-10 21:05 UTC)
Pagename: RBM10, rev. 1079530668
Script-generated diff page (copy): User:Mathglot/sandbox/RefRenamer tests/RBM10
Symptom: table shows 80 rows but the Diff shows that only one ref was applied ("Johnston-2010"; three occurrences)

SYSTEM:

Windows 10 Version 21H2
Javascript V8 10.8.168.25
Browsers (same symptom on all three):
  Vivaldi 5.6.2867.62
  Chrome Version 109.0.5414.121
  Firefox 109.0.1 64-bit.

CONDITIONS:

Fallback stack (default) Last-First-Auth-Website-Pub-FirstPhrase
no: Lowercase
no: Remove diacritics
no: Remove punct
yes: Replace space with: {nothing; i.e, remove spaces}
yes: Year yes: any 4-digit num
Delim b4 year: -
Increment starts at: 1
Delim b4 incr: {nothing}
no: Always insert delim
no: Ins delim only > num
no: Remove unused
Ref table: 80 items; nothing unusual.

ACTIONS:

  • Ref table alterations: modified #38 from "CancerGenomeAtlasResearchNetwork-2014" to "CGARN-2014"
  • Hit APPLY: no
  • Hit CONTINUE: yes


NOTES:
The generated ref table shows 80 rows, from Wang-2013 (#1) to Lim-2006 (#80). All 80 items very nicely Last-YYYY, except for #38, "CancerGenomeAtlasResearchNetwork-2014", which I overrode to "CGARN-2014", and pressed "Continue", leading to the diff shown, which contains three occurrences of "Johnston-2010", but no other changes.

Not sure if it's worth it, but if there was an unobtrusive link somewhere to capture this info for you if something went awry, it would make it easier for non-savvy bug reporters to get you the information you need to reproduce and examine. Thanks, Mathglot (talk) 23:27, 10 February 2023 (UTC)[reply]

It's because most of = in name="..." in the source were preceded or followed by a space, which I didn't prepare for. Fixed. Nardog (talk) 23:45, 10 February 2023 (UTC)[reply]
Wow, that was fast! Thanks much. Mathglot (talk) 23:47, 10 February 2023 (UTC)[reply]

Script unwatchlists articles?

[edit]

Just installed the script (which is great -- don't know why this isn't just baked into VE), but strangely, every edit I made with it also unwatchlisted the article? — Rhododendrites talk \\ 14:38, 15 February 2023 (UTC)[reply]

Right, it unwatched pages unless you checked "Watch this page" yourself. Fixed. Nardog (talk) 15:20, 15 February 2023 (UTC)[reply]

Two rows marked '0' in first column

[edit]

I'm looking at Draft:Cybullying, written by a student editor, and the table looks odd, and I'm not sure if it's a markup problem in the text, or something else. In particular, row #2, which duplicates the "0" which already appears in row #1, an empty middle cell, and then the 3rd cell has "No change", which I'm not sure if it's RefRenamer trying to tell me an error/warning, or whether that text is in the article:

This is what I'm seeing in this example
# Reference New name
0 Panda mediacenter: 52 alarming cyberbullying statistics and facts for 2023 Pandamediacenter-2023
0
No change checked box
1 http://www.nces.gov http
2 Faucher, C., Cassidy, W., & Jackson, M. (2020). Awareness, Policy, Privacy, and More: Post-Secondary Students Voice Their Solutions to Cyberbullying. European Journal of Investigation in Health, Psychology and Education, 10(3), 795–815. https://doi.org/10.3390/ejihpe10030058 Faucher-2020

Do you need details about my defaults to reproduce? Articles like this written by student editors sometimes have significant markup problems, and if that's what's going on here, it may not be worth trying to work around it. Mathglot (talk) 05:14, 16 February 2023 (UTC)[reply]

That's because there are multiple {{reflist}}s with no group=. It says "Cite error: The named reference :0 was invoked but never defined" right on the page. Nardog (talk) 11:58, 16 February 2023 (UTC)[reply]

i18n

[edit]

This is a great script. Can you please add internationalization feature to the code? Jeeputer Talk 18:46, 16 February 2023 (UTC)[reply]

Unfortunately I didn't intend this script to be useful outside the English Wikipedia and I don't plan to change that. Each site is different and there's no guarantee the script is going to be useful on it; it only supports ASCII numerals, and assumes COinS metadata is usually available, for example. Accommodating other sites could make the script unwieldy pretty easily. So if you want to use it on another wiki, I suggest you fork it and add capabilities yourself. I'm sorry. Nardog (talk) 15:49, 17 February 2023 (UTC)[reply]
@Nardog: That's okay. I will do that and will add appropriate attributions. Thank you. Jeeputer Talk 10:58, 18 February 2023 (UTC)[reply]
@Jeeputer:, if you do fork it to another site, can you ping me? My js skills are near-zero, but general programming skills should allow me to observe the changes in your version vs. Nardog's, and copy/tweak them to hack out a new one for a third language project. (If you can leave comment hints inline about anything that looks obscure that I might not get, or maybe just a section in the /doc about what to change to internationalize it, that would be great.) Thanks! Mathglot (talk) 18:54, 21 February 2023 (UTC)[reply]
@Mathglot: Sure! I'm working on it and will let you know when it's done. Jeeputer Talk 00:09, 22 February 2023 (UTC)[reply]
FWIW I'd be happy to help you fork it for another wiki if you tell me what options are needed. It's just an international/cross-wiki version that I'm not willing to create. Nardog (talk) 00:37, 22 February 2023 (UTC)[reply]
@Nardog: Thank you. I'm trying to create a base fork on enwiki so users can load it from here. i18n.json subpage now holds language messages, but looks like local JSON files are not accessible from other wikis (or at least I don't know how can we have access to them). I have tested it on fawiki and got "No 'Access-Control-Allow-Origin' header is present on the requested resource". I'm reading documentation for mw.Message (as used for Cat-a-lot) to see if it cat be used instead. Am I in the right path? Jeeputer Talk 09:06, 22 February 2023 (UTC)[reply]
Looks like the script will work, at least on fawiki, without i18n (i.e. calling your original script). but we need translations for its interface. that's what I'm trying to do. Jeeputer Talk 09:15, 22 February 2023 (UTC)[reply]
I can just add the translation capability (and perhaps CSS for RTL) in my script, but would that be enough? Is COinS metadata so frequently available you could rely on it? And wouldn't you need digit conversion? What about CE vs Hijri? Is the prevailing convention in name="..." on fawiki to use the Persian script or something ASCII/Latin/LTR-based? Nardog (talk) 11:25, 22 February 2023 (UTC)[reply]
I think that's enough. as far as i can see, COinS is available in some random featured articles I checked (for example you can run the script on مک‌لارن ۷۲۰اس). It is also available on other articles I randomly checked. Digit conversion is also not necessary because ref names usually do not contain Persian numbers. But if you had time, you can add the feature to make the script more reliable on non-Latin-language wikis. There is no actual convention for ref names on fawiki, but VE ref names are frequently used with ASCII numerals. Actually, I think fawiki users think Persian ref names don't work (same about Scribuntu modules' page name). :D Editors use Fingilish names for Farsi-language sources. Jeeputer Talk 12:00, 22 February 2023 (UTC)[reply]
I mean digit conversion for extracting years from ref metadata/text. And do you use CE or Hijri in ref names and ref text respectively? Nardog (talk) 12:06, 22 February 2023 (UTC)[reply]
I get it, in that way we need digit conversion. Many references have Solar Hijri years and some of them use Islamic (lunar) calendar. lunar years are less used because Farsi-language sources use Solar calendar. both CE and Hijri (both types) may be used as ref names and in ref text. Jeeputer Talk 12:12, 22 February 2023 (UTC)[reply]

Updated the script with i18n and the documentation with instructions on l13n. I've refactored some variable names so you might lose some of your preferences. Nardog (talk) 09:12, 23 February 2023 (UTC)[reply]

@Nardog: Thank you. I will use it on fawiki and will let you know if I see any issues (If any!). Again, thank you for this awesome script.
@Mathglot: i18n capability is added thanks to Nardog. Jeeputer Talk 11:40, 23 February 2023 (UTC)[reply]

Minor edits

[edit]

I notice when running the script that the checkbox for "Minor edit" is pre-checked. I don't know if that's coming from my preferences somehow, or from the script. These are definitely not minor edits, and if the script is setting that box, it should do the opposite, even to the point of overriding whatever the user's default or preference is. Nothing that changes a reference name is a minor edit. If this is on me, my apologies for the report. Thanks, Mathglot (talk) 03:41, 4 April 2023 (UTC)[reply]

That's intentional. The only changes the script makes are WP:COSMETIC (though they do concern HTML output, but nothing visual), which says they're "almost always marked as minor edits". AFAIC reference names are, in the grand scheme of things, pretty minor, as they're nobody's business but editors' and don't affect the reading experience at all. I don't want edits via the script to be marked not minor, especially if they're clogging up my watch. Nardog (talk) 12:02, 4 April 2023 (UTC)[reply]

Replace "auto" ref name?

[edit]

I think this script should also replace the refname of "auto" which is produced when the reFill tool replaces a reference that is used twice iwth a ref name. It's about as undescriptive as the ref names of ":0" or ":1" ― Blaze WolfTalkBlaze Wolf#6545 14:58, 5 April 2023 (UTC)[reply]

That doesn't seem as common as VE names, so I don't think I'll single them out, but supporting non-VE names has been on my to-do. But it would involve some fundamental changes to the script and I'm not sure what's a good way to go about it. Nardog (talk) 09:31, 6 April 2023 (UTC)[reply]
Now adds "auto", "auto1", "autogenerated", "autogenerated1", etc. by default. Nardog (talk) 02:34, 4 December 2023 (UTC)[reply]
I completely forgot about this Nice! ― Blaze WolfTalkblaze__wolf 02:56, 4 December 2023 (UTC)[reply]

Refrenamer choking on Waist-to-height ratio

[edit]
Moved from User talk:Nardog

I've used RefRenamer quite happily for some time now, but when I tried it on Waist-to-height ratio, it tried to swallow a porcupine tail first. BUT now that I recall, the numbered references were hand-crafted, not created by the "other" editing interface. But I thought you might like a challenge. . 𝕁𝕄𝔽 (talk) 23:04, 28 April 2023 (UTC)[reply]

@John Maynard Friedman: Thanks for the report. Ahh, I forgot about list-defined references. I'm kinda surprised it took this long for a user of the script to encounter and report this problem, but perhaps I shouldn't be given VE doesn't output LDRs, as you point out. I'll try to deal with it but in the meantime you can uncheck "Remove unreused names". Nardog (talk) 23:31, 28 April 2023 (UTC)[reply]
No rush, as far as I am concerned. Surely it would be more useful to leave it as is, so that you have a real world test case for the code revision when you get time to write it. --𝕁𝕄𝔽 (talk) 23:36, 28 April 2023 (UTC)[reply]
That's very kind of you ;) Nardog (talk) 00:33, 29 April 2023 (UTC)[reply]
@John Maynard Friedman: Should work on pages with list-defined references now. Please let me know if you come across any further issue. Nardog (talk) 23:38, 29 April 2023 (UTC)[reply]
Poyfick! Clean run, as expected, including changing some long-winded suggestions. TYVM. Great tool. --𝕁𝕄𝔽 (talk) 23:57, 29 April 2023 (UTC)[reply]

The source does not contain ref names to rename.

[edit]

I've tried using this script and I'm presented with this message on all pages. For example Geography has plenty of named ref, and yet nothing. Headbomb {t · c · p · b} 07:21, 5 August 2023 (UTC)[reply]

I see it just wants to tackle VE refs... so I guess this is functioning as intended. Headbomb {t · c · p · b} 09:28, 5 August 2023 (UTC)[reply]

Now supports non-VE names

[edit]

I've added support for ref names other than VE-style ones, as discussed in some sections above. Use this section if you have feedback. Nardog (talk) 21:41, 11 September 2023 (UTC)[reply]

FYI: Headbomb, given the previous section. Mathglot (talk) 19:37, 14 October 2023 (UTC)[reply]

Optional alpha uniqueness suffix

[edit]

I see you've been active lately, so I wonder if this is a good time to request an alternative to the numeric suffix for uniqueness, in order to support alpha uniqueness as well. Enabled by some checkbox, presumably. I invariably alter the YYYY-1, YYYY-2, etc. uniqueness suffixes to YYYYa, YYYYb; following the convention recommended at Template:Sfn#More than one work in a year, and elsewhere, but it's pretty tedious keeping track, and getting the sequence right. I bet there's a library somewhere that can generate a..z for the first 26, then aa, ab, ... az for the next 26, and so on; not that that would happen very often, but someone has already figured it out for rendering footnotes, so you could just steal it. Mathglot (talk) 09:56, 12 September 2023 (UTC)[reply]

This turned out to be more complicated than I thought because, while appending suffixes to second and later occurrences of the same name is easy, retroactively modifying the first one as well requires some fundamental changes to the way it generates names. Nardog (talk) 02:29, 25 September 2023 (UTC)[reply]
Couldn't it work like the numeric id's work now? Just don't modify the first one, like you don't modify it for numeric uniqueness tags. So, whereas now we have Jones-2023, Jones-2023-1, Jones-2023-2, etc., under the new option we'd have Jones-2023, Jones-2023a, Jones-2023b, so nothing retroactive, or what am I missing? Mathglot (talk) 02:44, 25 September 2023 (UTC)[reply]
That certainly makes it easier, though I'm only familiar with Jones-2023a etc. with no Jones-2023. Added. Nardog (talk) 01:31, 26 September 2023 (UTC)[reply]
Hooray! Thank you! Mathglot (talk) 01:36, 26 September 2023 (UTC)[reply]
It now starts with Jones-2023a etc. regardless of the choice in "Collision resolution", unless names were generated at different points in time ("Add all" etc.). Nardog (talk) 21:09, 15 January 2024 (UTC)[reply]
Better and better; love it! Hope you are having half as much fun fine-tuning it, as I am enjoying its utility. Really fine job. For the first time, I'm feeling twinges of future nostalgia, thinking I'll miss the script, if they ever fix up VE so it doesn't create the cruft that led to the script in the first place! Mathglot (talk) 04:03, 16 January 2024 (UTC)[reply]

Bug report (probably unrelated)

[edit]

Thought I had found a bug in the Latin increment stuff, because the first article I checked ran into a problem. But now I think that was just my bad luck, because five further tests all worked brilliantly. So, first, here's the problematic one:

  • The Lord of the Rings (film series)
    • The problem: the script proposes reduplicated year values, like, Nathan 20182018 or Nathan 20182018a
    • What should it do? No reduplication. Suggested: Nathan 2018 or Nathan 2018a
    • Fallback: last, first, author, periodical/website, pub, first phrase
    • Checked: -diacrit, year (fall back any 4; Use Latin [Start with: a; Incr starts with: 1])

The following five, on the other hand, all work perfectly:

Minor point: when Latin is checked, 'Start with a ↓' appears; but 'Increment starts with 1 ↓' is still visible, below it. Should the latter be masked, when Latin is checked?

Thanks for this wonderful addition to the script, which is really becoming indispensable. Mathglot (talk) 02:38, 26 September 2023 (UTC)[reply]

"Nathan 2018" is coming from "First phrase". <ref>{{harvnb|Nathan|2018|...}}</ref> should be converted to using {{sfn}}, which some refs already do.
Should the latter be masked, when Latin is checked? No, because for refs where a year is not found, numeric increments will still be used. Perhaps the label should say "Numeric increments start at". Nardog (talk) 05:19, 26 September 2023 (UTC)[reply]
Ah, I understand (both points) now; thanks very mu○h for the analysis and commentary. Mathglot (talk) 05:42, 26 September 2023 (UTC)[reply]

Edits marked 'minor'

[edit]

I noticed that my RefRenamer edits are marked 'minor'. This seems to be a gray area, as WP:MINOR doesn't give any guidance for mass changes to references (other than WP:CITEVAR, which doesn't apply here). On the one hand, section § What to mark as minor changes bullet 3 says that "Formatting that does not change the meaning of the page" is to be marked "minor", and paragraph two of the lead agrees, and Refrenamer edits seems to fit that. On the other hand, bullet five in that section, and the first paragraph of the lead seem to argue the other way. Also, volume may play a part; when I think of "fixing a typo" or "fixing a reference", I usually think of one or two or a handful of fixes as a "minor" fix; but in my edit to COVID-19 pandemic in Saskatchewan which added 1,138 bytes (1180129988), including my overriding the default proposed by RefRenamer in several dozen refs because I looked up the author name in refs that didn't have them, it seems like with the potential for error on my part, and the sheer volume of it, it shouldn't be marked minor.

I honestly don't know which is better, "minor" or "not minor" as a default. Maybe one could split the difference, and uncheck "minor" under some predefined conditions, such as, "more than ten VE numeric ref names changed per RefRenamer default, or "user supplied custom name in five or more default names in the last column" or something. Then again, the "minor checkbox" is such a minor issue, that if it were my script, I probably wouldn't be inclined to spend more than fifteen minutes trying to improve the 'minor edit" as nobody cares about it anyway, so maybe that's the answer right there. My personal feeling is that the "minor edit" feature in general creates more problems than it solves and they ought to get rid of it, but probably I don't see the whole picture, and as long as we have it, I suppose one has to decide what to do about it. Mathglot (talk) 19:33, 14 October 2023 (UTC)[reply]

If none of the meaning, paragraph structure, etc... is change, those are minor changes and shouldn't be marked as otherwise just because there's a lot of them. Headbomb {t · c · p · b} 20:13, 14 October 2023 (UTC)[reply]

great tool!

[edit]

I can't believe it's taken me ten months to discover this, I've been complaining about those VE refnames since I first discovered them in an article, even more frustrating once I started actually using VE myself and realized I had to toggle back and forth to name refs something readable by humans. Thank you so much for this! Valereee (talk) 15:26, 20 November 2023 (UTC)[reply]

@Valereee: see also Wikipedia:Wikipedia_Signpost/2023-08-01/Tips_and_tricks for other similar scripts. Headbomb {t · c · p · b} 21:20, 20 November 2023 (UTC)[reply]

RefRenamer support for pmid, s2cid and other reference attributes

[edit]
Moved from User talk:Nardog

Hello!

Please consider added support for pmid, s2cid and other reference attributes for RefRenamer.

I updated the script to support these attributes and tested in my local common.js, you can diff your code with https://wiki.riteme.site/wiki/User:Maxim_Masiutin/RefRenamer-core.js to see what was changed.

Thank you! Maxim Masiutin (talk) 20:39, 3 December 2023 (UTC)[reply]

The whole point of this script is to make ref names more intelligible and identifiable to humans, so using such identifiers strikes me as self-defeating. Nardog (talk) 21:42, 3 December 2023 (UTC)[reply]
It is a choice of preference of particular editors what is more convenient for them, more intelligible and more identifiable. Editors of medical articles refer to PubMed (pmid) identifiers between themselves even in discussions, and they are humans. This is even confirmed by tools used for medical references, such as https://citation-template-filling.toolforge.org/cgi-bin/index.cgi that generate references based on pmid. Besides that, such references, since relying on unique identifiers, help prevent occasional duplications. When there are hundreds of such references in an article, it is hard to imagine something better, because a closest alternative, such as the first name of the first author and the year does not work well for such a big number of references. An when almost all the references with pmid except a few ones, the RefRenamer would have helped to rename them to the common style. Also, according to Wikipedia:Manual_of_Style/Dates_and_numbers, the editors should preserve format according to a consensus, otherwise use format established by the first major contributor should be respected. My understanding is that this rule also applies to reference formats. Maxim Masiutin (talk) 21:53, 3 December 2023 (UTC)[reply]
WP:REFNAME says: Names should have semantic value, so that they can be more easily distinguished from each other by human editors who are looking at the wikitext. This means that ref names like "Nguyen 2010" are preferred to names like ":31337". Nardog (talk) 02:14, 4 December 2023 (UTC)[reply]
Semantics names are "names having a meaning" ("so that they can be more easily distinguished from each other by human editors who are looking at the wikitext") - this is exactly true for the medical editors when they work with pmids, which makes more sense than "Nguyen 2010", because on practiece you end up with "Nguyen 2010-2", "Nguyen 2010-4", and so on, so you are lost; I don't speak about meaningless numbers such as ":31337". Maxim Masiutin (talk) 02:23, 4 December 2023 (UTC)[reply]
Then be at peace with the fact this is not a tool for that.
As for your fork, I noticed that it could create ref names that consist of numerals only, which are invalid. I've added a safeguard against such names in my script, so you might want to sync your fork. Nardog (talk) 02:44, 4 December 2023 (UTC)[reply]
No, it could not, because a prefix of characters is always added for those attributes. An example is "pmid345325". Which semantic value is easier distinguishable by a person is a personal preference. The fork that took already supports these attributes. Thank you very much for your tool and for you time. Maxim Masiutin (talk) 02:56, 4 December 2023 (UTC)[reply]
I tested your fork and it generated names with just ISBNs. So if an unhyphenated ISBN is used and a year is not checked or found, it generates an invalid name. Nardog (talk) 03:13, 4 December 2023 (UTC)[reply]
Ah, OK, thank you! That makes sense. I mostly use sources that have pmid or s2cid. I should have probably not added ISBN at all, because it does not make sence. Probably only pmid should have been enough, because other attributes do not fall into a category of having semantic value, as you correctly pointed out. Let me modify the fork to remove all except pmid. Maxim Masiutin (talk) 03:27, 4 December 2023 (UTC)[reply]
I removed all the attributes at my fork except pmid. Also, for pmid, the year attribute is ignored even if setting is ON. I am now quite happy, thank you very much again! You've made my day. Maxim Masiutin (talk) 03:53, 4 December 2023 (UTC)[reply]
Can you please consider implementing only pmid as in my fork, as the other attributes are not actually needed. This option should not be by default, so it would not do any harm. I would have used the master copy of the bot in this case. Thank you! Maxim Masiutin (talk) 15:51, 6 December 2023 (UTC)[reply]
I've added a sort of API so any user can implement highly customized renaming code without forking. For your case, try
mw.hook('refrenamer.rename').add(function (ref) {
	if (ref.props.pmid) {
		ref.newName = 'pmid' + ref.props.pmid;
	}
});
Nardog (talk) 21:17, 12 January 2024 (UTC)[reply]
Can you please help me use the new API, so I could understand where to insert this code.
Currently, my page https://wiki.riteme.site/wiki/User:Maxim_Masiutin/common.js contains the following line:
importScript('User:Maxim Masiutin/RefRenamer.js'); // [[User:Maxim Masiutin/RefRenamer.js]]
To which lines should I replace that line?
Thank you again! Maxim Masiutin (talk) 04:08, 13 January 2024 (UTC)[reply]
Don't replace anything, just add the code above to your common.js. (Whether it precedes or follows importScript doesn't matter because the importing occurs asynchronously.) Nardog (talk) 05:20, 13 January 2024 (UTC)[reply]
Thank you! I've added this code and checked - it works properly! Thank you very much again! Maxim Masiutin (talk) 08:16, 15 January 2024 (UTC)[reply]

first/last vs. author in RefRenamer

[edit]

This is a wonderful tool, I've spent too much time doing it manually. One of the first things I do before running RefRenamer is convert all |author= -> |last= and |first=. It is a good idea anyway, plus it keeps the suggestions by RR consistent with last name only. It naturally raises the question, why we don't have a tool that can do this automatically. Or even built into RR. It's probably more complex than it seems due to edge cases, but it might not be difficult to catch the low hanging fruit ie. where |author= exists, and no other author field names, and has 2 to 3 words with no commas or other punctuation (other than a single-letter followed by period eg. Tom R. Smith). This would probably be 80% of cases and fairly easy. -- GreenC 03:34, 30 December 2023 (UTC)[reply]

@GreenC:, sorry I didn't see this earlier. I sometimes also make that author ⟶ last/first manip (and others), not always as a RefRenamer prep step, but also for other reasons. In any case, you might have a look at these regexes in case they're of any use to you. Mathglot (talk) 01:45, 4 June 2024 (UTC)[reply]
I was checking the CS1|2 documentation a few days ago and learned |author= can include non-person names like companies or institutions. BTW nice regexes, some of those I solved before but probably not as well, will keep in mind. -- GreenC 02:15, 4 June 2024 (UTC)[reply]

Edit summary issue

[edit]

Unless adding in other ref groups, when just updating from the primary list it appears as if an automated edit summary is added ("Replaced VE ref names using RefRenamer"). When attempting to publish the changes, I am warned of not having an edit summary. ☾Loriendrew☽ (ring-ring) 18:39, 1 January 2024 (UTC)[reply]

This should be fixed now. Nardog (talk) 13:22, 2 January 2024 (UTC)[reply]
It is! Thank you for the timely fix.--☾Loriendrew☽ (ring-ring) 22:42, 2 January 2024 (UTC)[reply]

Reduplicated year in New Name column for very sparse citations

[edit]

I'm seeing unusual behavior at Regency of Algiers for citations that are very sparse: the proposed new name in col. 3 shows reduplicated year for many citations in this article, but not for longer citations. For example, for :2, the entirety of the reference in col. 2 of the table is 'Ruedy 2005, p. 30', and col. 3 is 'Ruedy 2005-2005a'. Numerous other rows have the same problem. One row with Arabic text has that problem, as well as another problem involving directional tags I think: for :11, 1994-1994 الجيلالي I was not able to select the entire content of that cell in order to paste here, I had to use three separate copy-paste operations. (That's minor and I don't care and don't need it fixed; I'm only mentioning it in case there's something going on there that you care about, and didn't know already.) Thanks, Mathglot (talk) 06:22, 16 January 2024 (UTC)[reply]

This is similar to #Bug report (probably unrelated) above. I suggest you convert <ref>{{harvsp|...}}</ref> to {{sfn|...}} first. Nardog (talk) 04:02, 17 January 2024 (UTC)[reply]
Oh yes, sorry; forgot about that one. Thanks, Mathglot (talk) 04:04, 17 January 2024 (UTC)[reply]

Large change appears to have worked

[edit]

You might be interested in a large (45kb) change at List of fake news websites. Before I got there, the article was already over 600kb, and when WP:DIFF tried to show me the diff, it hung up my browser tab. I doubt this has anything to do with RefRenamer, but I'm unable to view the Renamer results even now, and since it was such a large change, it would be good to know that it really worked. I can't see the results of the diff even coming directly from the history page, so I'm unable to verify it. I filed a bug on the Diff program about it. Would be interesting to know if you can view the diff (iffy diff; save your work first). I have 16gb of memory, about 5.6 gb free. Mathglot (talk) 09:50, 16 January 2024 (UTC)[reply]

Not updating repeated references when the repeated reference is in the form {{r|"some name"}}

[edit]

Hi Nardog,

I've come accross what's potentially an error when using RefRenamer. I used it at Special:Diff/1190527187 only for another editor to need to do a correction later on at Special:Diff/1197528194 because it had failed to update one of the repeated references which had form {{r|"some name"}} TarnishedPathtalk 04:34, 21 January 2024 (UTC)[reply]

See User:Nardog/RefRenamer#Limitations. Since templates vary by wiki and can change at any time, the script doesn't support them. Nardog (talk) 03:09, 22 January 2024 (UTC)[reply]
@Nardog, ok no worries. I'm be mindful to search for them whenever I use RefRenamer then. Kind Regards, TarnishedPathtalk 03:18, 22 January 2024 (UTC)[reply]
It now warns you if a template like {{r}} is likely using a ref name that is eligible for being renamed. Nardog (talk) 12:37, 22 January 2024 (UTC)[reply]
@Nardog handy. Thanks. TarnishedPathtalk 12:58, 22 January 2024 (UTC)[reply]

Adding names to unnamed refs?

[edit]

For reasons I don't understand, VE has added some refs which don't have any name attribute at all (for example, Special:Diff/1209797986). Is there some way to add names to those? RoySmith (talk) 15:48, 5 March 2024 (UTC)[reply]

Mismatched quotes

[edit]

I didn't realize I should be looking for this, but the tool doesn't like when there are mismatched quotes. See Special:Diff/1217360711 where some ":n" terms were left behind because they didn't have matched quotes around them. I went back and fixed it, obviously, but it would be good if the tool could do that better. Thanks for all your hard work! - UtherSRG (talk) 12:36, 5 April 2024 (UTC)[reply]

Fixed, hopefully. Nardog (talk) 10:19, 6 April 2024 (UTC)[reply]

Proposed enhancement: watchlist option

[edit]

Hi, Nardog. My watchlist is slowly increasing as I use the tool, because my default is to add anything I edit to my watchlist. Would it be possible to have a new, 'watchlist option' section, where it asks what I want to do wrt watching, i.e., watch temporarily, permanently, or not at all? I always forget to do it at the bottom of the page, and if I publish, it appears to be too late, or at least, I haven't figured out how to set a temporary watch after the fact. Having a sticky watch option would be nice.

Maybe echo the dropdown I have now (not sure if it's a gadget, or baked in) which defaults to watch indefinitely, but also allows choosing watch for 1 week, 2 weeks, 1 month, 2 months, Indefinitely (default). If this could be sticky, that would be ideal: normally, I don't want to add RefRenamer-adjusted articles to my watchlist permanently, but I would like to have it there for a week or two, while I watch whether other editors get confused, revert, or whatever. If it's stable for a bit, then my work is done there, and I'm happy for it to fall off my watchlist automatically after the temp period expires. Thanks, Mathglot (talk) 18:40, 21 April 2024 (UTC)[reply]

I have noticed, that if I edit, bring up RefRenamer, scroll down and set my watch period to, say, two weeks and then go through the refrenamer items and hit Continue, it resets it to 'Indefinitely' (my default), overriding my previous choice. Mathglot (talk) 18:54, 21 April 2024 (UTC)[reply]
Can't reproduce this. If you still can, please describe the steps you took in more detail (especially the "I edit, bring up RefRenamer" part). Nardog (talk) 09:18, 22 April 2024 (UTC)[reply]
I see little reason to add this complexity to RefRenamer because, as you point out, the interface already exists in the default edit form. I suggest you disable "Add pages and files I edit to my watchlist", remember to uncheck "Watch this page", or use User:Rummskartoffel/auto-watchlist-expiry. Nardog (talk) 09:31, 22 April 2024 (UTC)[reply]

RefRenamer is on my menu twice, can't uninstall or disable

[edit]

Nardog, something has gone wrong with my RefRenamer. On User:Chiswick_Chap/skin.js I can see "User:Nardog/RefRenamer.js, loaded from en.wikipedia (Uninstall | Disable)" but neither of the two buttons there work, and when I have any Wikipedia page displayed, "RefRenamer" appears twice on the menu on the left hand side. How do I clear all this? Chiswick Chap (talk) 13:45, 10 September 2024 (UTC)[reply]

Remove the last two lines in User:Chiswick Chap/common.js. The script is loading itself so every script you have installed is running twice. Nardog (talk) 15:04, 10 September 2024 (UTC)[reply]
Many thanks! Chiswick Chap (talk) 15:28, 10 September 2024 (UTC)[reply]

Where is the button?

[edit]

I installed the tool, but don't see the button to use it, where is it located and how to fix (with instructions)? Susbush (talk) 17:14, 1 October 2024 (UTC)[reply]

Look in your tools menu. Go on an article, search for "tools" and you should find where it is in your browser interface. Headbomb {t · c · p · b} 22:46, 1 October 2024 (UTC)[reply]
I checked the "Tools" option in the sidebar, but it only says "Expand bare references" and "Fix dead links", how to fix?? Susbush (talk) 06:39, 2 October 2024 (UTC)[reply]
There should be a 'RefRenamer' option. Try on desktop. Headbomb {t · c · p · b} 07:15, 2 October 2024 (UTC)[reply]
I even did that but I don't see that option. Susbush (talk) 07:16, 2 October 2024 (UTC)[reply]
Pls reply how to fix Susbush (talk) 14:53, 2 October 2024 (UTC)[reply]
Now I see the option Susbush (talk) 17:16, 2 October 2024 (UTC)[reply]