[go: nahoru, domu]

Jump to content

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

Frá Wikipedia, hin frælsa alfrøðin
Content deleted Content added
avritað frá ensku Wikipediu
 
Xqbot (kjak | íkøst)
s Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]
 
Linja 9: Linja 9:
Load the module:
Load the module:


<source lang="lua">
<syntaxhighlight lang="lua">
local mSeealso = require('Module:See also')
local mSeealso = require('Module:See also')
</syntaxhighlight>
</source>


You can then use the _seealso function like this:
You can then use the _seealso function like this:


<source lang="lua">
<syntaxhighlight lang="lua">
mSeealso._seealso(options, ...)
mSeealso._seealso(options, ...)
</syntaxhighlight>
</source>


The parameters following <var>options</var> are a list of link/display tables, used to generate the see also links. The first value in each table is the link, and is required. The link can be just a page name, or can include a section link if desired. Links specifying a section are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
The parameters following <var>options</var> are a list of link/display tables, used to generate the see also links. The first value in each table is the link, and is required. The link can be just a page name, or can include a section link if desired. Links specifying a section are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
Linja 28: Linja 28:


; Example 1
; Example 1
<source lang="lua">
<syntaxhighlight lang="lua">
mSeealso._seealso(nil, {'A'})
mSeealso._seealso(nil, {'A'})
</syntaxhighlight>
</source>
Produces:
Produces:
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A]]</div></nowiki></code>
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A]]</div></nowiki></code>
Linja 37: Linja 37:


; Example 2
; Example 2
<source lang="lua">
<syntaxhighlight lang="lua">
mSeealso._seealso(nil, {'A'}, {'B'}, {'C'})
mSeealso._seealso(nil, {'A'}, {'B'}, {'C'})
</syntaxhighlight>
</source>
Produces:
Produces:
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A]], [[B]] and [[C]]</div></nowiki></code>
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A]], [[B]] and [[C]]</div></nowiki></code>
Linja 46: Linja 46:


; Example 3
; Example 3
<source lang="lua">
<syntaxhighlight lang="lua">
mSeealso._seealso(nil, {'A', 'the letter "A"'}, {'B', 'the letter "B"'}, {'C', 'the letter "C"'})
mSeealso._seealso(nil, {'A', 'the letter "A"'}, {'B', 'the letter "B"'}, {'C', 'the letter "C"'})
</syntaxhighlight>
</source>
Produces:
Produces:
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A|the letter "A"]], [[B|the letter "B"]] and [[C|the letter "C"]]</div></nowiki></code>
:<code><nowiki><div class="hatnote boilerplate seealso">See also: [[A|the letter "A"]], [[B|the letter "B"]] and [[C|the letter "C"]]</div></nowiki></code>
Linja 55: Linja 55:


; Example 4
; Example 4
<source lang="lua">
<syntaxhighlight lang="lua">
mSeealso._seealso({altphrase = 'Another page to see', selfref = true}, {'A#B'})
mSeealso._seealso({altphrase = 'Another page to see', selfref = true}, {'A#B'})
</syntaxhighlight>
</source>
Produces:
Produces:
:<code><nowiki><div class="hatnote boilerplate seealso selfref">Another page to see: [[A#B|A § B]]</div></nowiki></code>
:<code><nowiki><div class="hatnote boilerplate seealso selfref">Another page to see: [[A#B|A § B]]</div></nowiki></code>

Seinasta endurskoðan sum var 22. apr 2020 kl. 16:38

This module produces a "See also: a, b and c" link. It implements the {{see also}} template.

Usage from wikitext

[rætta wikitekst]

This module cannot be used directly from #invoke. Instead, it can only be used through the {{see also}} template. Please see the template page for documentation.

Usage from other Lua modules

[rætta wikitekst]

Load the module:

local mSeealso = require('Module:See also')

You can then use the _seealso function like this:

mSeealso._seealso(options, ...)

The parameters following options are a list of link/display tables, used to generate the see also links. The first value in each table is the link, and is required. The link can be just a page name, or can include a section link if desired. Links specifying a section are automatically formatted as page § section, rather than the MediaWiki default of page#section.

The second value in each table is the display value, and is optional.

The options variable is an optional configuration table. The following fields are recognised:

  • altphrase - an alternative phrase to "See also". Should be a string, if specified.
  • selfref - set to true to flag the output as a self-reference to Wikipedia. (See the {{selfref}} template for more details on self-references.)
Example 1
mSeealso._seealso(nil, {'A'})

Produces:

<div class="hatnote boilerplate seealso">See also: [[A]]</div>

Displays as:

See also: A
Example 2
mSeealso._seealso(nil, {'A'}, {'B'}, {'C'})

Produces:

<div class="hatnote boilerplate seealso">See also: [[A]], [[B]] and [[C]]</div>

Displays as:

See also: A, B og C
Example 3
mSeealso._seealso(nil, {'A', 'the letter "A"'}, {'B', 'the letter "B"'}, {'C', 'the letter "C"'})

Produces:

<div class="hatnote boilerplate seealso">See also: [[A|the letter "A"]], [[B|the letter "B"]] and [[C|the letter "C"]]</div>

Displays as:

Example 4
mSeealso._seealso({altphrase = 'Another page to see', selfref = true}, {'A#B'})

Produces:

<div class="hatnote boilerplate seealso selfref">Another page to see: [[A#B|A § B]]</div>

Displays as:

Another page to see: A § B

Technical details

[rætta wikitekst]

This module uses Module:Hatnote to format the hatnote text, Module:TableTools to process the list of links, and Module:Arguments to fetch the arguments from wikitext.