Jump to content

Template talk:Autoname

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Autoname/doc)
Latest comment: 6 days ago by Ponor in topic Bug with plain-text references

Module:Autoname/sandbox

[edit]

@Trappist the monk Thanks for the work you did splitting off Module:Autoname from Module:Citation. I created a sandbox version at Module:Autoname/sandbox that fetches the various aliases from Module:Citation/CS1/Configuration rather than hardcoding them in its own data page. I also expanded it to include other fields such as work or title for web or news sources without a named author. Do you have any objection to grabbing those values from Module:Citation/CS1/Configuration (such as changes to that page's format breaking this template), or do you see this as a valid path forward to keeping the templates in sync? --Ahecht (TALK
PAGE
)
18:55, 19 October 2026 (UTC)Reply

I've tweaked your tweak to move the parameter-name fetch into ~/data; no need to perform that task with every autonaming in a page rendering. Also tweaked params_order_t and enum_params_order_t to put contributors first; this is how cs1|2 does it when creating CITEREF anchor IDs.
I included CITEREF in the rendered output because it matches the CITEREF anchor IDs in the error messages emitted by Module:Footnotes ({{harvnb}}, {{sfn}}, etc) and the error and warning messages emitted by HarvErrors.js. And, after all, CITEREF anchor IDs have become a sort of de facto standard that is familiar to some editors. At some point in the far future (if ever) when there are enough references named using this scheme, finding all of the multiple sfn targets in an article, for example, might be made easier if the error message matches the name produced by autoname – double-click the CITEREF in the error message then Ctrl-F and Bob's your mother's brother. This doesn't work if the reference 'name' is not the same as the 'name' listed in the error or warning message.
Is anyone going to be using this module or are we just doing this for the fun of it? I haven't seen any evidence that editors really care how references are named.
—Trappist the monk (talk) 00:35, 20 October 2026 (UTC)Reply
@Trappist the monk Thanks for the insight. I originally had the fetch in /data and moved it out, but I can see the logic in keeping it there. I would like to get this rolled out, as there's a reason that scripts like RefRenamer are widely used. I've requested admin access at TestWiki so we can test these scripts there before rolling them out on EnWiki. --Ahecht (TALK
PAGE
)
14:02, 20 October 2026 (UTC)Reply
RefRenamer: Oh yay, yet another standard. Does Editor Nardog know about this standard? Ought they not be the same? Are there other 'standards' out there that should be conjoined with autoname and RefRenamer?
—Trappist the monk (talk) 14:21, 20 October 2026 (UTC)Reply
There aren't any tests on the ~/testcases page to test for 'periodical', 'encyclopedia', 'title', and 'booktitle'. Unless you beat me to it, I'll do that tomorrow.
—Trappist the monk (talk) 00:39, 20 October 2026 (UTC)Reply
Some wikis have created autoname modules as well, you might want to take a look to see if there are useful ideas – e.g. both fr:Module:NomRefAuto and de:VisualEditorRef provide an option to extract the domain from |url= to create meaningful names for {{cite web}} citations that don't have an author. Johannes Richter (WMDE) (talk) 11:06, 20 October 2026 (UTC)Reply
I added a version of that to this module. --Ahecht (TALK
PAGE
)
15:38, 20 October 2026 (UTC)Reply
I moved the sandbox to the main module, and tested that module on testwiki: where it appears to be working well. If there are no objections, I'll update {{Autoname}} to use the module. --Ahecht (TALK
PAGE
)
19:48, 22 October 2026 (UTC)Reply
 Done --Ahecht (TALK
PAGE
)
17:35, 29 October 2026 (UTC)Reply

Date param aliases

[edit]

I copied the module to hrwiki, but the date processing has some hard-coded parameter names (for date, d_dab) that I'll need to update to use local names as well. Even on enwiki, en:Module:Citation/CS1/Configuration has some aliases for date, publication-date and similar. I was wondering if you'd want to include those, like you do for some other params in param_alias_keys_t. Ponor (talk) 19:04, 5 November 2026 (UTC)Reply

Also in other languages: there will be aliases for year, see for example https://hr.wikipedia.org/wiki/Modul:Citation/CS1/Configuration#L-352; https://sl.wikipedia.org/wiki/Modul:Citation/CS1/Configuration#L-411; https://it.wikipedia.org/wiki/Modulo:Citazione/Configurazione#L-158; https://es.wikipedia.org/wiki/M%C3%B3dulo:Citas/Configuraci%C3%B3n#L-198... I understand you don't need to deal with them on the English Wikipedia, but since many will copy this module, that'd be also nice to have. Thanks! Ponor (talk) 02:35, 6 November 2026 (UTC)Reply
fixed in the sandbox, I think; see Template:Autoname/testcases § date & year & disambiguation
—Trappist the monk (talk) 18:07, 6 November 2026 (UTC)Reply

Bug with plain-text references

[edit]

Lua will throw an error when dealing with plain-text references, as in Special:Diff/1383996428. 17 article so far. Ponor (talk) 01:51, 6 November 2026 (UTC)Reply

I've added a simple test for the existence of the positional parameters {{{1}}}. If found, the module will return nil.
I suspect, without any evidence to the contrary, that deciphering plain-text citations is beyond the capabilities of a simple module – mostly because a plain-text citation can be anything, anything at all. I think that I recall that there are 'fallback' names but I don't remember where (or if) I actually saw mention of them. If there are 'fallback' names, what are they so they can be implemented?
—Trappist the monk (talk) 02:09, 6 November 2026 (UTC)Reply
There are fallback names, yes. In English, it should be Reference-N. But I suspect we'll get the fallback name if the module returns an empty string instead of this error message. Try re-using the two refs in User:Ponor/sandbox/tabularasa. Ponor (talk) 02:17, 6 November 2026 (UTC)Reply
It looks like they all include calls of some other templates, such as {{Cite Q}}, {{ISBN}}, {{e}}. Ponor (talk) 02:10, 6 November 2026 (UTC)Reply
fixed in the sandbox, I think; see Template:Autoname/testcases § plain-text citations. Changed from the above to ignore positional parameters because some citation templates that mix named and positional parameters may have summat that can be made into a name.
When a name cannot be created or the result is a glaring red script error message, the module returns nil.
—Trappist the monk (talk) 18:28, 6 November 2026 (UTC)Reply
Looks good, TYVM! I have Special:Permalink/1384117792 live on hrwiki now. Ponor (talk) 21:03, 6 November 2026 (UTC)Reply