Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Tales from Chyria
Search
Editing
Module talk:Hatnote
(section)
From Tales from Chyria
Namespaces
Module
Discussion
More
More
Page actions
Read
Edit source
New topic
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Redlink detection in _formatLink == On a few hatnote templates, {{u|MB}} has requested that I add redlink detection, because it's a reasonably common error that could be tracked and fixed. I've [[Special:Diff/1059393371|sandboxed]] a basic implementation of that functionality, adding [[:Category:Articles with hatnote templates targeting a nonexistent page]]. I'd like feedback that this looks okay; the obvious misgiving that people might have is that checking for a page's existence is an "expensive operation", so this would introduce many thousands of "expensive" operations across the site. On the other hand, it's not ''that'' expensive on balance, and it wouldn't take up much of the limit for most pages. The other issue is that it might produce "false positives" via uses of {{tl|format link}}, which reuses the hatnote functionality; this could probably be mitigated in several ways. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 21:17, 11 December 2021 (UTC) :I don't know if your solution will apply to all hatnotes and you don't need a list of specific templates to update or not. If the latter, I recently found a case of {{txl|main}} with a redlink target. [https://en.wikipedia.org/w/index.php?title=Rivi%C3%A8re_de_la_Tortue_(Delson)&oldid=1060368099 this version] of [[Rivière de la Tortue (Delson)]] has a redlink target in {{txl|other uses}}. That template has the "poorly implemented" check, but it didn't seem to work. Just mentioning this in case it is of interest or use in developing/testing your implementation. [[User:MB|<b style="color:#034503">MB</b>]] 02:49, 15 December 2021 (UTC) ::This solution would apply to essentially all hatnotes that use automatic lists, by adding the check to the automatic formatting that those use. It wouldn't apply to wikitext-based hatnotes, which would have to have the functionality added manually per template, which should be easy. In the [[Rivière de la Tortue (Delson)]] example, the "poorly implemented" check failed because it only checks for a redlink when defaulting is used, while that page specifies the disambiguation page manually. My design checks for redlinks in all "target" links (it won't catch links in text inputs, but that's okay). <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 18:15, 16 December 2021 (UTC) :I think that adding redlink detection for hatnote templates is a good idea, but I'm not sure that coupling it to the formatLink function is the way to go. {{tl|Format link}} is [https://en.wikipedia.org/w/index.php?title=Special%3AWhatLinksHere&target=Template%3AFormat+link&namespace=10 used] in several templates that don't relate to hatnotes, and having pages using these templates outputting a hatnote tracking category would be confusing. How about creating a separate function in [[Module:Hatnote]] that does the check for existence and then calls formatLink? Existing hatnote modules would need to be updated to use the new function, but it should only be a one-line fix for each module, and it would avoid any potential confusion. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 05:30, 15 December 2021 (UTC) ::I've updated the sandbox implementation to mitigate the problems somewhat. The prototype requires passing an option, allowing the category to be changed by supplying it as a category name string (an empty string disables categorization), or using the default with any non-string truthy value. I've specified "true" for most of the native methods (AFAICT only formatLink is used outside hatnotes), and added a parameter passthrough for the formatLink method that {{tl|format link}} uses. That means the current prototype shouldn't affect {{tlf|format link}} and similar unless the user explicitly asks for it by specifying a category name to use in case of a redlink. That's probably a good "quick" solution. That said, having done that work, the ''cleanest'' solution would probably be to extract the link-formatting functionality into its own module (including the optional redlink categorization I've prototyped)—since it's being used outside hatnotes ''in the first place''—and then to call that module inside [[Module:Hatnote]]'s link-formatting functions, which could then (more) safely assume that they were hatnote-specific. I'm not eager to do the work for that, but it'd probably be a better long-term solution. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 18:15, 16 December 2021 (UTC) ===Extracting formatLink=== I've done a decent chunk of the work to extract the functionality of <code>formatLink</code> and <code>_formatLink</code> to [[Module:Format link]], as that seems to be the most sensible restructuring given that {{tl|format link}} doesn't necessarily concern hatnotes. The code at that module integrates improvements I've made that allow an option, specified as a parameter to <code>formatLink</code> or a string option to <code>_formatLink</code>, to enable redlink categorization if and only if specified, with the specified category name. Similarly, [[Module:Hatnote/sandbox]] has been updated to remove the base formatLink functionality, to call the new module, and to specify a default hatnote redlink-target category name. A <span class="plainlinks">[https://en.wikipedia.org/w/index.php?search=hastemplate%3A%22Module%3AHatnote%22+insource%3A%2FformatLink%2F&title=Special:Search&profile=advanced&fulltext=1&ns828=1 few other modules]</span> will need updating to match, but … does this look reasonable as designed? It still couples formatting a link to error detection (meh), but it's done in a much more generalized way that's not hatnote-specific where implemented. I'll need to do some more work to update testcases (migrating some from the hatnote module to the new module, adding some to test the new functionality) and (re)write documentation, but it's largely ready to go, so I'd appreciate further feedback ({{u|Mr. Stradivarius}}, especially). Thanks, <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 18:50, 20 December 2021 (UTC) :{{ping|Nihiltres}} Yes, I think this is a good direction to take, and I agree with splitting _formatLink out into its own module. Thank you for all of your work on this. Thinking about it, p.formatPages and p.formatPageTables might be better off in [[Module:Format link]] than [[Module:Hatnote]] - they seem conceptually closer to formatting links than to hatnotes per se, and they are not used elsewhere in the Hatnote module. Having said that, moving them will create extra work, and I don't feel incredibly strongly either way. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:10, 21 December 2021 (UTC) ::Thanks for your review; it really helps my motivation for the less-fun work on documentation and tests. :) I finally took a good look at those two methods, which I'd earlier assumed were widely integrated into hatnote modules. The first, <code>formatPages</code> has a couple of uses, so I added a generalized analogue (allowing the categorization option) to [[Module:Format link]]. The second, <code>formatPageTables</code>, can probably be simply deleted as it's unused outside of sandboxes. I think it's ''probably'' safe for me to (boldly) implement the changes, but I'll definitely get documentation, tests, and such working first. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 19:32, 21 December 2021 (UTC) {{undent}}(ping {{u|MB}}) {{done}} — all hatnotes with redlink targets that use automatic formatting will now point to [[:Category:Articles with hatnote templates targeting a nonexistent page]], and it's done through a separated [[Module:Format link]]. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 22:50, 26 December 2021 (UTC) :I see there are over 400 pages in the category already, so this is definitely worthwhile. Can you restrict the detection to article space only? There is no real reason to care about these in other name spaces. Thanks. [[User:MB|<b style="color:#034503">MB</b>]] 22:57, 26 December 2021 (UTC) ::Actually, some of these are See also in category headers, so those should probably be clean-ed up also. [[User:MB|<b style="color:#034503">MB</b>]] 23:04, 26 December 2021 (UTC) :::{{u|Nihiltres}}, not sure if you saw the above. Many cases are in USER and DRAFT space, for which there is little or no reason to care. Can these be excluded from the tracking? [[User:MB|<b style="color:#034503">MB</b>]] 04:39, 31 December 2021 (UTC) ::::{{u|MB}} Ah, OK, I'd thought your second comment totally negated the first. I'll draft a namespace-based filter and implement it in the next round of updating—there's also some feature request stuff happening over at [[Module talk:Format link]] that I'm looking at. I'm thinking to exclude the user namespace, the draft namespace, and all talk namespaces. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 05:05, 31 December 2021 (UTC) :::::{{u|Nihiltres}}, at first I was thinking to exclude everything except article. But then I saw that hatnotes are used on Categories. Definitely exclude User, Draft, all talk. I saw some in Templates, but if those are actually transcluded, they will show up in the articles. I'm not sure if there are any "reader facing" namespaces to track except article and Category, so an include list may be shorter than an exclude list. Certainly not a big problem, just something to improved when you can. Thanks. [[User:MB|<b style="color:#034503">MB</b>]] 05:18, 31 December 2021 (UTC) ::::::{{u|MB}} {{done}} in [[Special:Diff/1063743122]]. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 18:26, 4 January 2022 (UTC) ==== {{tl|format linkr}} ==== FYI {{ping|Nihiltres|MB|Mr. Stradivarius}} Above changes broke {{tl|format linkr}}. Diagnosis at {{format linkr|User_talk:TryKid#%7B%7Bformat_linkr%7D%7D}}. {{small|(Yes, I do note the irony of using {{tl|format linkr}} to talk about {{tl|format linkr}}.)}} I think template editors need to start checking systematically for uses of exposed APIs, not just changing common templates/modules. This broke a ton of pages, including some in article space. No disrespect, it's obviously a volunteer project, I'm just making you aware that this change did not go smoothly and breakage only found/corrected days later. [[User:Psiĥedelisto|Psiĥedelisto]] ([[User talk:Psiĥedelisto|talk]] • [[Special:Contributions/Psiĥedelisto|contribs]]) <sup>please ''always'' [[Help:Notifications|ping]]!</sup> 13:19, 27 December 2021 (UTC) :That's on me. I ''did'' check for uses, but changed my search query early on to something Lua-specific that no longer showed {{tl|format linkr}}, and thus missed that one. My apologies. <span style="white-space:nowrap;">{{[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]] |[[User talk:Nihiltres|talk]] |[[Special:Contributions/Nihiltres|edits]]}}</span> 16:12, 27 December 2021 (UTC) ::{{re|Nihiltres}} No problem, just was making you aware since you have the right so hopefully will remember next time. I've broken plenty of running production systems in my time lol. Also, it's a good reminder to me that {{tl|format linkr}} has a special role, I really made it for talk pages and not article space (it's much more convenient to paste a section from URL bar with the linkr version), but it seems at some point I forgot and started just using it everywhere. It's been copied to Vietnamese Wikipedia, not by me, so seems others find it useful, but it's a good point to keep in mind, not to use it if the link I'm writing won't benefit. [[User:Psiĥedelisto|Psiĥedelisto]] ([[User talk:Psiĥedelisto|talk]] • [[Special:Contributions/Psiĥedelisto|contribs]]) <sup>please ''always'' [[Help:Notifications|ping]]!</sup> 01:00, 28 December 2021 (UTC)
Summary:
Please note that all contributions to Tales from Chyria may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Chyria Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs