Module:Hatnote/doc: Difference between revisions

Content deleted Content added
Examples: change order
remove rellink, update hatnote, and update makeWikitextError
Line 18:
 
<source lang="lua">
mHatnote._hatnote(s, options)
</source>
 
Formats the string <var>s</var> as a hatnote. This encloses <var>s</var> in the tags {{tag|div|params=class="dablinkrellink"}}. TheOptions CSSare ofprovided in the dablink<var>options</var> classtable. isOptions defined in [[MediaWikiinclude:Common.css]].
* <var>options.extraclasses</var> - a string of extra classes to provide
* <var>options.selfref</var> - if this is not nil or false, adds the class "selfref", used to denote self-references to Wikipedia (see [[Template:Selfref]]))
The CSS of the rellink class is defined in [[MediaWiki:Common.css]].
 
; Example 1
 
<source lang="lua">
Line 34 ⟶ 37:
Displays as:
{{hatnote|This is a hatnote.}}
 
=== Rellink ===
 
<source lang="lua">
mHatnote._rellink(s, extraclasses)
</source>
 
Formats the string <var>s</var> as a "related articles" link. This encloses <var>s</var> in the tags {{tag|div|params=class="rellink"}}. The CSS of the dablink class is defined in [[MediaWiki:Common.css]]. Extra classes can be added as the string <var>extraclasses</var>.
 
; Example 1
 
<source lang="lua">
mHatnote._rellink('This is a related article link.')
</source>
 
Produces:
{{tag|div|content=This is a related article link.|params=class="rellink"}}
 
Displays as:
{{rellink|This is a related article link.}}
 
; Example 2
 
<source lang="lua">
mHatnote._rellink('This is a related article linkhatnote.', {extraclasses = 'boilerplate seealso', selfref = true})
</source>
 
Produces:
{{tag|div|content=This is a related article linkhatnote.|params=class="rellink boilerplate seealso selfref"}}
 
Displayed as:
{{rellinkhatnote|This is a related article linkhatnote.|extraclasses=boilerplate seealso|selfref=true}}
 
=== Format link ===
Line 114 ⟶ 97:
 
<source lang="lua">
mHatnote._makeWikitextError(msg, demo)
</source>
 
Formats the string <var>msg</var> as a red wikitext error message. Normally this function also adds [[:Category:Hatnote templates with errors]]; however, if <var>demo</var> is true then the category is suppressed.
 
Example: