Content deleted Content added
m →Rellink: remove extra example |
add format link function |
||
Line 66:
Displayed as:
{{rellink|This is a related article link.|extraclasses=boilerplate seealso}}
=== Format link ===
<source lang="lua">
mHatnote._formatLink(link, display)
</source>
Formats <var>link</var> as a wikilink for display in hatnote templates, with optional display value <var>display</var>. Categories and files are automatically escaped with the [[Help:Colon trick|colon trick]], and links to sections are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
;Examples:
: {{code|mHatnote._formatLink('Lion')|lua}} → <nowiki>[[Lion]]</nowiki> → {{format hatnote link|Lion}}
: {{code|mHatnote._formatLink('Lion#Etymology')|lua}} → <nowiki>[[Lion#Etymology|Lion § Etymology]]</nowiki> → {{format hatnote link|Lion#Etymology}}
: {{code|mHatnote._formatLink('Category:Lions')|lua}} → <nowiki>[[:Category:Lions]]</nowiki> → {{format hatnote link|Category:Lions}}
: {{code|mHatnote._formatLink('Lion#Etymology', 'Etymology of lion')|lua}} → <nowiki>[[Lion#Etymology|Etymology of lion]]</nowiki> → {{format hatnote link|Lion#Etymology|Etymology of lion}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
|