Diferencia entre revisiones de «Módulo:Hatnote/doc»
(start docs) |
(add hatnote function) |
||
Línea 4: | Línea 4: | ||
The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see [[Template:Hatnote]], [[Template:Rellink]] and [[Template:Format hatnote link]] for documentation. | The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see [[Template:Hatnote]], [[Template:Rellink]] and [[Template:Format hatnote link]] for documentation. | ||
+ | |||
+ | == Use from other Lua modules == | ||
+ | |||
+ | To load this module from another Lua module, use the following code. | ||
+ | |||
+ | <source lang="lua"> | ||
+ | local mHatnote = require('Module:Hatnote') | ||
+ | </source> | ||
+ | |||
+ | You can then use the functions as documented below. | ||
+ | |||
+ | === Hatnote === | ||
+ | |||
+ | <source lang="lua"> | ||
+ | mHatnote._hatnote(s) | ||
+ | </source> | ||
+ | |||
+ | Formats the string <var>s</var> as a hatnote. This encloses <var>s</var> in the tags {{tag|div|params=class="dablink"}}. The CSS of the dablink class is defined in [[MediaWiki:Common.css]]. | ||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| |
Revisión del 12:35 24 abr 2014
This is a meta-module that provides various functions for making hatnotes. It implements the {{hatnote}} template, for use in disambiguation hatnotes at the top of pages, and the {{rellink}} template, for use in making links to related articles directly under section headings. It also implements the {{format hatnote link}} template, which is used to format a wikilink for use in hatnotes.
Use from wikitext
The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see Template:Hatnote, Template:Rellink and Template:Format hatnote link for documentation.
Use from other Lua modules
To load this module from another Lua module, use the following code.
<source lang="lua"> local mHatnote = require('Module:Hatnote') </source>
You can then use the functions as documented below.
Hatnote
<source lang="lua"> mHatnote._hatnote(s) </source>
Formats the string s as a hatnote. This encloses s in the tags <div class="dablink">...</div>
. The CSS of the dablink class is defined in MediaWiki:Common.css.