Difference between revisions of "Module:Hatnote group/doc"
blackwiki>Nihiltres (Basic documentation) |
test>Nihiltres (Documentation!) |
||
| Line 1: | Line 1: | ||
| − | {{ | + | {{Documentation subpage}} |
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | ||
| − | + | {{Lua|Module:Hatnote group}} | |
| + | |||
| + | This experimental template applies [[Module:Hatnote group]] to merge hatnotes it is given as input; this has the net effect of making them formatted inline relative to one another. For example: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | {{about|USE1||PAGE1}} | ||
| + | {{redirect|REDIRECT|USE2|PAGE2}} | ||
| + | </nowiki></pre> | ||
| + | |||
| + | would normally display as: | ||
| + | |||
| + | {{about|USE1||PAGE1}} | ||
| + | {{redirect|REDIRECT|USE2|PAGE2}} | ||
| + | |||
| + | but, when wrapped in this template: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | {{hatnote group| | ||
| + | {{about|USE1||PAGE1}} | ||
| + | {{redirect|REDIRECT|USE2|PAGE2}} | ||
| + | }} | ||
| + | </nowiki></pre> | ||
| + | |||
| + | displays as | ||
| + | |||
| + | {{hatnote group| | ||
| + | {{about|USE1||PAGE1}} | ||
| + | {{redirect|REDIRECT|USE2|PAGE2}} | ||
| + | }} | ||
| + | |||
| + | Technically, it changes the hatnotes by converting their <code><nowiki>div</nowiki></code> wrappers into <code><nowiki>span</nowiki></code>s, wrapping the group in a new hatnote <code>div</code>, and migrating classes appropriately. Classes are migrated to the appropriate <code>span</code>, unless every hatnote in the group includes that class, in which case the class will be migrated to the new <code>div</code> wrapper. For example: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | {{hatnote|extraclasses=example demonstration |Hatnote 1}} | ||
| + | {{hatnote|extraclasses=example |Hatnote 2}} | ||
| + | {{hatnote|extraclasses=example |Hatnote 3}} | ||
| + | </nowiki></pre> | ||
| + | |||
| + | would normally be rendered to: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | <div role="note" class="hatnote example demonstration">Hatnote 1</div> | ||
| + | <div role="note" class="hatnote example">Hatnote 2</div> | ||
| + | <div role="note" class="hatnote example">Hatnote 3</div> | ||
| + | </nowiki></pre> | ||
| + | |||
| + | but, when wrapped in this template, becomes: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | <div role="note" class="hatnote example"> | ||
| + | <span class="demonstration">Hatnote 1</span> | ||
| + | <span>Hatnote 2</span> | ||
| + | <span>Hatnote 3</span> | ||
| + | </div> | ||
| + | </nowiki></pre> | ||
| + | |||
<includeonly>{{sandbox other|| | <includeonly>{{sandbox other|| | ||
<!-- Categories below this line, please; interwikis at Wikidata --> | <!-- Categories below this line, please; interwikis at Wikidata --> | ||
| − | [[Category:Hatnote | + | [[Category:Hatnote templates| ]] |
}}</includeonly> | }}</includeonly> | ||
Revision as of 19:27, 28 October 2016
| This is a documentation subpage for Module:Hatnote group. It contains usage information, categories and other content that is not part of the original module page. |
| This template uses Lua: |
This experimental template applies Module:Hatnote group to merge hatnotes it is given as input; this has the net effect of making them formatted inline relative to one another. For example:
{{about|USE1||PAGE1}}
{{redirect|REDIRECT|USE2|PAGE2}}
would normally display as:
Script error: No such module "about".
but, when wrapped in this template:
{{hatnote group|
{{about|USE1||PAGE1}}
{{redirect|REDIRECT|USE2|PAGE2}}
}}
displays as
Script error: No such module "hatnote group".
Technically, it changes the hatnotes by converting their div wrappers into spans, wrapping the group in a new hatnote div, and migrating classes appropriately. Classes are migrated to the appropriate span, unless every hatnote in the group includes that class, in which case the class will be migrated to the new div wrapper. For example:
{{hatnote|extraclasses=example demonstration |Hatnote 1}}
{{hatnote|extraclasses=example |Hatnote 2}}
{{hatnote|extraclasses=example |Hatnote 3}}
would normally be rendered to:
<div role="note" class="hatnote example demonstration">Hatnote 1</div> <div role="note" class="hatnote example">Hatnote 2</div> <div role="note" class="hatnote example">Hatnote 3</div>
but, when wrapped in this template, becomes:
<div role="note" class="hatnote example"> <span class="demonstration">Hatnote 1</span> <span>Hatnote 2</span> <span>Hatnote 3</span> </div>