Module:Section link/doc: Difference between revisions

Content deleted Content added
add examples
 
(7 intermediate revisions by 6 users not shown)
Line 1:
{{used in system|in [[MediaWiki:Abusefilter-warning-notwallofshame]]}}
{{Module rating|protected}}
This module creates links to sections, nicely formatted with the "§" symbol instead of the default "#".
 
== Usage ==
 
Line 11 ⟶ 12:
First, load the module:
 
<sourcesyntaxhighlight lang="lua">
local mSectionLink = require('Module:Section link')
</syntaxhighlight>
</source>
 
You can then make section links via the _main function.
 
<sourcesyntaxhighlight lang="lua">
mSectionLink._main(page, sections, options, title)
</syntaxhighlight>
</source>
 
Parameters:
* <var>page</var> - the page name to link to. Defaults to the full page name of <var>title</var>, or the current title if that is not specified.
* <var>sections</var> - an array of section names to link to, or a string to link to just one section name. (required)
* <var>options</var> - a table of options (optional). Accepts the following optionsfields:
** <var>nopage</var> - set this to true to avoid displaying the base page name in links.
* <var>title</var> - a default [[mw:Extension:Scribunto/Lua reference manual#Title objects|mw.title object]] to use instead of the current title (optional). Intended for testing purposes.
All parameters are optional.
 
== Examples ==
Line 35 ⟶ 37:
! Wikitext code
! Result
|-
| {{code|mSectionLink('Paris')|lua}}
| <code><nowiki>{{section link|Paris}}</nowiki></code>
| {{section link|Paris}}
|-
| {{code|mSectionLink('Paris', 'Architecture')|lua}}
Line 52 ⟶ 58:
| {{section link|Paris|Architecture|Culture|Sport|nopage=yes}}
|}
== See also ==
*The character used is {{unichar|00A7|name=|html=|nlink=Section sign}}
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandboxSandbox other| |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Link modules]]
 
}}</includeonly>