Munurin millum rættingarnar hjá "Module:Main/doc"

126 bytes løgd afturat ,  7 mánaðir síðan
s
Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]
(Stovnaði síðu við "This module produces a link to a main article or articles. It implements the {{tl|main}} template. Normally, it produces a link like "Main article: A". If used in the He...")
 
s (Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html])
 
Load the module:
 
<sourcesyntaxhighlight lang="lua">
local mMain = require('Module:Main')
</syntaxhighlight>
</source>
 
You can then use the _main function like this:
 
<sourcesyntaxhighlight lang="lua">
mMain._main(options, ...)
</syntaxhighlight>
</source>
 
The parameters following <var>options</var> are a list of link/display tables, used to generate the links. The first value in each table is the link, and is required. The second value in each table is the display value, and is optional. Category or file links are automatically escaped using the [[Help:Colon trick|colon trick]]. If a link includes a section name, and no display value is set, links are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
 
; Example 1
<sourcesyntaxhighlight lang="lua">
mMain._main(nil, {'A'})
</syntaxhighlight>
</source>
Produces:
:<code><nowiki><div class="hatnote relarticle mainarticle">Main article: [[A]]</div></nowiki></code>
 
; Example 2
<sourcesyntaxhighlight lang="lua">
mMain._main(nil, {'Wikipedia:Categorization'}, {'Help:Category'}, {'Category:Wikipedia categories'})
</syntaxhighlight>
</source>
Produces:
:<code><nowiki><div class="hatnote relarticle mainarticle">Main pages: [[Wikipedia:Categorization]], [[Help:Category]] and [[:Category:Wikipedia categories]]</div></nowiki></code>
 
; Example 3
<sourcesyntaxhighlight lang="lua">
mMain._main(nil, {'A', 'the letter "A"'}, {'B', 'the letter "B"'}, {'C', 'the letter "C"'})
</syntaxhighlight>
</source>
Produces:
:<code><nowiki><div class="hatnote relarticle mainarticle">Main articles: [[A|the letter "A"]], [[B|the letter "B"]] and [[C|the letter "C"]]</div></nowiki></code>
 
; Example 4
<sourcesyntaxhighlight lang="lua">
mMain._main({selfref = true}, {'Wikipedia:Verifiability#Burden'})
</syntaxhighlight>
</source>
Produces:
:<code><nowiki><div class="hatnote relarticle mainarticle selfref">Main article: [[Wikipedia:Verifiability#Burden|Wikipedia:Verifiability § Burden]]</div></nowiki></code>
 
; Example 5 (if used in the category namespace)
<sourcesyntaxhighlight lang="lua">
mMain._main(nil, {'A'})
</syntaxhighlight>
</source>
Produces:
:<code><nowiki><div class="hatnote relarticle mainarticle">The main article for this [[Wikipedia:Categorization|category]] is [[A]]</div></nowiki></code>
14.816

rættingar