Module talk:Redirect hatnote: Difference between revisions

Content deleted Content added
Old TFD – 2018 August 9: no consensus (XFDcloser)
Line 221:
 
We have gazillions of hatnotes in the form {{tlx|redirect|Municipal Waste|text{{=}}You may be looking for <nowiki>[[Municipal solid waste]]</nowiki>}}, or often just manually coded entirely with <code>:...</code> We need a parameter to generate this wording, e.g. {{para|lookingfor|<nowiki>[[Municipal solid waste]]</nowiki>}} preferably smart enough to detect if the value supplied resolves to a single page so that {{para|lookingfor|Municipal solid waste}} works. Would also be nice if this worked with all the applicable templates, like {{tlx|About}}. <span style="white-space:nowrap;font-family:'Trebuchet MS'"> — [[User:SMcCandlish|'''SMcCandlish''']] [[User talk:SMcCandlish|☏]] [[Special:Contributions/SMcCandlish|¢]] 😼 </span> 23:14, 30 July 2018 (UTC)
 
== Review for sandboxed changes ==
 
I've put [[Special:Diff/1014263301/1017809938|an update]] to this module in its sandbox. There are two main changes I've made:
# If the redirect title is found to not be a redirect, the new code tries to filter out cases where the page source contains "<code>#invoke:RfD</code>", categorizing them separately (in a yet-to-be created category) so that RfD'd redirects don't pollute the category for redirect hatnotes needing review. The filter itself is a bit obviously fragile, so if there's a better method to check for RfD status we should swap that out, but it should be ''good enough'' for now.
# Instead of using [[Module:Redirect]], the new code accesses the modern <code>redirectTitle</code> field from mwTitle, which returns either the target title of the redirect, or false. Removing use of a separate module in favour of built-in Scribunto functionality is probably preferable, and it simplifies the code a touch.
 
I've added a testcase for RfD'd pages to the testcases, and tweaked a false-positive test so that it works with the new code, but the testcases could probably use some more work. I'd appreciate any review that people might offer, or critique of the approach. <span style="white-space:nowrap;">{&#123;[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]]&#8202;&#124;[[User talk:Nihiltres|talk]]&#8202;&#124;[[Special:Contributions/Nihiltres|edits]]}&#125;</span> 20:36, 16 April 2021 (UTC)