User:Nihiltres/Sandbox

Source: Wikipedia, the free encyclopedia.

{{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

Template Type Based on Lua Implemented with Uses TEXT Supports selfref List type Rough usage count Notes
Template:About Core Yes Module:About No No For-see, or TEXT 149k
Template:About-distinguish Compound {{about}} & {{distinguish}} Yes Module:About-distinguish No No Or 519
Template:About-distinguish-text Compound variant {{about-distinguish}} No {{hatnote}} Yes No TEXT 515 Forces TEXT for distinguish-list.
Template:About other people Compound {{about}} & {{other people}} Yes Module:About other people No No And 405 Successfully replaced {{other people3}}, with a similar form but narrower scope and better syntax
Template:Broader Core Yes Module:Broader No Yes And 752
Template:Distinguish Core Yes Module:Distinguish No No Or, or TEXT 82k
Template:For Core Yes Module:For No Yes And 173k Standalone for-see with and-list in the "see" part.
Template:For multi
Variant {{for}} Yes Module:Hatnote list No No For-see 6k For-see list, filling niche of headless {{about}} more elegantly.
Template:For-text Variant {{for}} No {{hatnote}} Yes No For-see & TEXT 478 Forces TEXT for every "see" in for-see list. Seems inconsistent. Many uses fixed, some still can be replaced with {{
for multi
}}.
Template:Further Core Yes Module:Labelled list hatnote No Yes And 55k
Template:Further-text Variant {{further}} No {{hatnote}} Yes No And & TEXT 450 Similar to {{further}} but forces TEXT for each item (which is ugly). Bulk of (simple) uses simplified to {{further}}, but more is possible.
Template:Main Core Yes Module:Labelled list hatnote No Yes And 318k
Template:Main list Variant {{main}} Yes Module:Main list No No And 1374 Standalone for-see, like {{for}}, with preset "for" part. Template title misleading given difference from {{main}}? Might be better merged into {{main}}?
Template:Other hurricanes
Variant {{other uses}} and/or {{about}} No {{about}} No No 321 {{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 people Variant {{other uses}} Yes Module:Other people No No 34k Behaviour similar to {{other uses}} with custom string, either "other people named X" or "other people with the same name" depending on parameterization.
Template:Other places Variant {{other uses}} Yes Module:Other uses No No And 22k Similar form to {{other uses}}, but "other places with the same name"
Template:Other ships Variant {{other uses}} Yes Module:Other uses No No And 14k Similar form to {{other uses}} but "other ships with the same name".
Template:Other uses Core Yes Module:Other uses No No And 63k
Template:Other uses of Variant {{other uses}} Yes Module:Other uses of No No 1k Slightly different phrasing of "other uses" so that disambiguation link gets context. Phrase and target params, with defaulting for lack of each.
Template:Redirect Core Yes Module:Redirect hatnote No Yes For-see, or TEXT 48k
Template:Redirect2 Variant {{redirect}} Yes Module:Redirect hatnote No Yes For-see 1k As {{redirect}} but with two redirect items
Template:Redirect-distinguish Compound {{redirect}} & {{distinguish}} Yes Module:Redirect-distinguish No No Or 3k One redirect parameter
Template:Redirect-distinguish-text Compound variant {{redirect-distinguish}} No {{hatnote}} Yes No TEXT 352 Like {{redirect-distinguish}} but forces TEXT for second parameter
Template:Redirect-distinguish-for Compound variant {{redirect-distinguish}} & {{for}} No {{hatnote}} No No ??? 38 Like {{redirect-distinguish}} followed by a {{for}} in the same hatnote. Crazypants.
Template:Redirect-multi Variant {{redirect}} Yes Module:Redirect-multi No Yes For-see 567 Provides support for hatnotes listing ≥3 redirects. Has special defaulting and redirect parameters are preceded by a number-of-redirects parameter.
Template:Redirect-several Variant {{redirect}} No {{hatnote}} No No And 131 Similar 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-synonym Variant {{redirect}} No {{hatnote}} Yes No TEXT 490 REDIRECT, plus "REDIRECT may also refer to TEXT".
Template:See also Core Yes Module:Labelled list hatnote No Yes And 172k
Template:See also-text Variant {{see also}} No {{hatnote}} Yes No And & TEXT 668 Like {{see also}}, but each item TEXT like {{further-text}}.
Template:See introduction
Variant {{for}} No {{For}} No No 17 A standalone for-see but hardcoded "for" and specially-defaulted "see"; exactly one parameter.
Template:See Wiktionary Variant {{about}} No {{hatnote}} No No For-see? 150 Not unlike {{about}} but specifically for referring to Wiktionary.
Template:Similar names Variant {{other people}} Yes Module:Other uses No No Or 1867 Similar form to {{other people}} but "other people with similar names". Possibly a merge candidate?
Template:Year dab
Variant {{about}} No {{hatnote}} No No For-see? 2k Basically same form as {{about}} but hard-coded for the special needs of year pages for referring to their "(number)" counterparts and associated disambiguation pages.