Module:Hatnote/doc: Difference between revisions

Content deleted Content added
Examples: Rm deleted
Format link: document the new _formatLink parameters
Line 57:
 
<source lang="lua">
mHatnote._formatLink({link = link, display) = display, italicizePage = true, italicizeSection = true}
</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''.
 
If <var>italicizePage</var> is true then the page portion of the link is italicized, and if <var>italicizePage</var> is true then the section portion of the link is italicized.
 
;Examples:
: {{code|<source lang="lua" inline>mHatnote._formatLink({link = 'Lion')|lua}}</source> &rarr; <nowiki>[[Lion]]</nowiki> &rarr; {{format hatnote link|Lion}}
: {{code|<source lang="lua" inline>mHatnote._formatLink({link = 'Lion#Etymology')|lua}}</source> &rarr; <nowiki>[[Lion#Etymology|Lion § &amp;nbsp;Etymology]]</nowiki> &rarr; {{format hatnote link|Lion#Etymology}}
: {{code|<source lang="lua" inline>mHatnote._formatLink({link = 'Category:Lions')|lua}}</source> &rarr; <nowiki>[[:Category:Lions]]</nowiki> &rarr; {{format hatnote link|Category:Lions}}
: {{code|<source lang="lua" inline>mHatnote._formatLink({link = 'Lion#Etymology', display = 'Etymology of lion')|lua}}</source> &rarr; <nowiki>[[Lion#Etymology|Etymology of lion]]</nowiki> &rarr; {{format hatnote link|Lion#Etymology|Etymology of lion}}
: <source lang="lua" inline>mHatnote._formatLink{link = 'Quo warranto#Philippines', italicizePage = true}</source> &rarr; <nowiki>[[Quo warranto#Philippines|<i>Quo warranto</i> §&amp;nbsp;Philippines]]</nowiki> &rarr; {{format hatnote link|Quo warranto#Philippines|italicizepage=true}}
: <source lang="lua" inline>mHatnote._formatLink{link = 'Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice', italicizeSection = true}</source> &rarr; <nowiki>[[Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|Cybercrime Prevention Act of 2012 §&amp;nbsp;<i>Disini v. Secretary of Justice</i>]]</nowiki> &rarr; {{format hatnote link|Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|italicizesection=true}}
 
=== Format pages ===