Module:Hatnote/doc

From Captain of Industry Wiki
Jump to: navigation, search

This is the documentation page for Module:Hatnote

This is a meta-module that provides various functions for making hatnotes. It implements the {{hatnote}} template, for use in hatnotes at the top of pages, and the {{format link}} template, which is used to format a wikilink for use in hatnotes. It also contains a number of helper functions for use in other Lua hatnote modules.

Use from wikitext

The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see Wikipedia:Template:Hatnote and Wikipedia:Template:Format link for documentation.

Use from other Lua modules

To load this module from another Lua module, use the following code:

local mHatnote = require('Module:Hatnote')

You can then use the functions as documented below.

Hatnote

mHatnote._hatnote(s, options)

Formats the string s as a hatnote. This encloses s in the tags <div class="hatnote">. Options are provided in the options table. Options include:

  • options.extraclasses - a string of extra classes to provide
  • options.selfref - if this is not nil or false, adds the class "selfref", used to denote self-references to Wikipedia (see Wikipedia:Template:Selfref))

The CSS of the hatnote class is defined in Module:Hatnote/styles.css.

Example 1

mHatnote._hatnote('This is a hatnote.')

Produces: <div class="hatnote">This is a hatnote.</div>

Displays as:

See also