Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Hatnote group/doc
(section)
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!
==Technical details== The module attempts to find each hatnote-looking <code>div</code> element, and parse them into space-separated <code>span</code> elements wrapped in a larger, generic hatnote. First, it matches every pattern that "looks like a hatnote" in its input text; this is where most problems are likely to originate as the pattern is fairly sensitive to any difference in the form of a hatnote. From each of the pattern matches, it constructs a table. Each element ("row") of the table corresponds to one original hatnote, and is a table that contains a string with the rendered inner content of the hatnote, and an inner table containing any "extra" classes associated with that hatnote (e.g. <code>selfreference</code> from a {{tl|self reference}} hatnote, or any classes from the <code>extraclasses</code> parameter of {{tl|hatnote}}). It also separately looks for all categories in case they're present ''outside'' the hatnote <code>div</code> element, and adds them to a concatenated string of all "loose categories" to make sure they're not accidentally removed by the hatnote grouping process. Once all rows are available, it looks at the tables of classes. It adds every class from every row into a table of "universal" classes, then filters out the ones that aren't universal by looking at each row's list and eliminating an item if it isn't present in any one row. Then, "universal" classes are removed from each row's classes table, so that they're not duplicated later. This processing having been done, each row is formatted with a <code>span</code> element that includes the extra classes associated with that row, the <code>spans</code> for each row are joined as a space-separated list, the "loose categories" are tacked on in turn, and then the resulting string is fed into the main hatnote module, with extra classes on the main hatnote being supplied by collating the "universal classes" table into a space-separated list of its keys. <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Hatnote modules| ]] }}</includeonly>
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)