User:Nihiltres/Sandbox

{{subst:#invoke:LuaCall|main|pattern=%s (disambiguation)|string=Foo|string.format(pattern,string)}}

Ongoing projects and testing and stuff:

An actual sandboxy section!

 FA

Hatnote cleanup listings

Handy regex search-and-replace pairs

  • ([^\.,:;])\s*<\s*ref(\s*[^>]*)>([^<]*)<\s*\/\s*ref\s*>([\.,:;])
    • $1$4<ref$2>$3</ref>
  • ([^\.,:;])\s*<\s*ref\s*([^>]*)\s*\/>([\.,:;])
    • $1$3<ref $2 />
  • <\s*ref\s+name\s*=\s*([^"]*?)(\s*\/?)\s*>
    • <ref name="$1"$2>
  • <ref name="([^"]*?)"\/>
    • <ref name="$1" />
  • (\{\{[^\}]*?\|\s*title\s*=[^\}]*?\|\s*title\s*=)
    • $1

To do

In no particular order:

  • Add length check to for-see renderer to categorize long hatnotes
  • Double-check for unimplemented modules and module sandboxes to poke at
  • Actually implement Module:Labelled list hatnote in more templates like {{see also}} etc.
  • Review hatnote-related CSS classes, with an eye to getting each documented and/or deprecated
  • Look into the specifics of {{pagelist}}; there's substantial overlap with Module:Hatnote list and the former could use some significant cleanup
  • Add more to this list!

Notes from a survey of the main group of hatnote templates

TemplateTypeBased onLuaImplemented withUses TEXTSupports selfrefList typeRough usage countNotes
Template:AboutCoreYesModule:AboutNoNoFor-see, or TEXT149k
Template:About-distinguishCompound{{about}} & {{distinguish}}YesModule:About-distinguishNoNoOr519
Template:About-distinguish-textCompound variant{{about-distinguish}}No{{hatnote}}YesNoTEXT515Forces TEXT for distinguish-list.
Template:About other peopleCompound{{about}} & {{other people}}YesModule:About other peopleNoNoAnd405Successfully replaced {{other people3}}, with a similar form but narrower scope and better syntax
Template:BroaderCoreYesModule:BroaderNoYesAnd752
Template:DistinguishCoreYesModule:DistinguishNoNoOr, or TEXT82k
Template:ForCoreYesModule:ForNoYesAnd173kStandalone for-see with and-list in the "see" part.
Template:For multiVariant{{for}}YesModule:Hatnote listNoNoFor-see6kFor-see list, filling niche of headless {{about}} more elegantly.
Template:For-textVariant{{for}}No{{hatnote}}YesNoFor-see & TEXT478Forces TEXT for every "see" in for-see list. Seems inconsistent. Many uses fixed, some still can be replaced with {{for multi}}.
Template:FurtherCoreYesModule:Labelled list hatnoteNoYesAnd55k
Template:Further-textVariant{{further}}No{{hatnote}}YesNoAnd & TEXT450Similar to {{further}} but forces TEXT for each item (which is ugly). Bulk of (simple) uses simplified to {{further}}, but more is possible.
Template:MainCoreYesModule:Labelled list hatnoteNoYesAnd318k
Template:Main listVariant{{main}}YesModule:Main listNoNoAnd1374Standalone for-see, like {{for}}, with preset "for" part. Template title misleading given difference from {{main}}? Might be better merged into {{main}}?
Template:Other hurricanesVariant{{other uses}} and/or {{about}}No{{about}}NoNo321{{about}}-start followed by {{other uses}} list (supporting at most one item) with custom defaults and misordered parameters ({{other hurricanes|OTHERUSES|ABOUT}}). Check for consistency in "other" family; this one uses "of the same name".
Template:Other peopleVariant{{other uses}}YesModule:Other peopleNoNo34kBehaviour similar to {{other uses}} with custom string, either "other people named X" or "other people with the same name" depending on parameterization.
Template:Other placesVariant{{other uses}}YesModule:Other usesNoNoAnd22kSimilar form to {{other uses}}, but "other places with the same name"
Template:Other shipsVariant{{other uses}}YesModule:Other usesNoNoAnd14kSimilar form to {{other uses}} but "other ships with the same name".
Template:Other usesCoreYesModule:Other usesNoNoAnd63k
Template:Other uses ofVariant{{other uses}}YesModule:Other uses ofNoNo1kSlightly different phrasing of "other uses" so that disambiguation link gets context. Phrase and target params, with defaulting for lack of each.
Template:RedirectCoreYesModule:Redirect hatnoteNoYesFor-see, or TEXT48k
Template:Redirect2Variant{{redirect}}YesModule:Redirect hatnoteNoYesFor-see1kAs {{redirect}} but with two redirect items
Template:Redirect-distinguishCompound{{redirect}} & {{distinguish}}YesModule:Redirect-distinguishNoNoOr3kOne redirect parameter
Template:Redirect-distinguish-textCompound variant{{redirect-distinguish}}No{{hatnote}}YesNoTEXT352Like {{redirect-distinguish}} but forces TEXT for second parameter
Template:Redirect-distinguish-forCompound variant{{redirect-distinguish}} & {{for}}No{{hatnote}}NoNo???38Like {{redirect-distinguish}} followed by a {{for}} in the same hatnote. Crazypants.
Template:Redirect-multiVariant{{redirect}}YesModule:Redirect-multiNoYesFor-see567Provides support for hatnotes listing ≥3 redirects. Has special defaulting and redirect parameters are preceded by a number-of-redirects parameter.
Template:Redirect-severalVariant{{redirect}}No{{hatnote}}NoNoAnd131Similar to {{redirect}} but uses a message about "several" redirects, then a for-see, forcing "other uses" and then an and-list. Few uses, but they're pretty solid.
Template:Redirect-synonymVariant{{redirect}}No{{hatnote}}YesNoTEXT490REDIRECT, plus "REDIRECT may also refer to TEXT".
Template:See alsoCoreYesModule:Labelled list hatnoteNoYesAnd172k
Template:See also-textVariant{{see also}}No{{hatnote}}YesNoAnd & TEXT668Like {{see also}}, but each item TEXT like {{further-text}}.
Template:See introductionVariant{{for}}No{{For}}NoNo17A standalone for-see but hardcoded "for" and specially-defaulted "see"; exactly one parameter.
Template:See WiktionaryVariant{{about}}No{{hatnote}}NoNoFor-see?150Not unlike {{about}} but specifically for referring to Wiktionary.
Template:Similar namesVariant{{other people}}YesModule:Other usesNoNoOr1867Similar form to {{other people}} but "other people with similar names". Possibly a merge candidate?
Template:Year dabVariant{{about}}No{{hatnote}}NoNoFor-see?2kBasically same form as {{about}} but hard-coded for the special needs of year pages for referring to their "(number)" counterparts and associated disambiguation pages.