Module:See also/doc

From Totem Arts Wiki
Revision as of 07:56, 30 May 2016 by Agent (talk | contribs) (1 revision imported: See also module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the documentation page for Module:See also

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

Usage from wikitext

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

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 role="note" class="hatnote">See also: [[A]]</div>

Displays as:

See also: A

Example 2

mSeealso._seealso(nil, {'A'}, {'B'}, {'C'})

Produces:

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

Displays as:

See also: A, B, and C

Example 3

mSeealso._seealso(nil, {'A', 'the letter "A"'}, {'B', 'the letter "B"'}, {'C', 'the letter "C"'})

Produces:

<div role="note" class="hatnote">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 role="note" class="hatnote selfref">Another page to see: [[A#B|A § B]]</div>

Displays as:

Another page to see: A § B

Technical details

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.