Wikipedia:Lua/Modul/Vorlage:Auflistung/en
Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
Vorlage:Auflistung
– Module to present horizontal lists with separators as continuous text. The list itself is a block element.
Functions for templates
Bearbeiten- f
- Present a list.
- 1
- List of items; each line starting with one of
*
or#
- If there is one item only no additional decoration will be generated.
- nowrap
1
– Every item kept on the same line- sep
- Contents of a separating
<span>
between items - styles
- Name of a TemplateStyles page
- classesBlock
- Class(es) for entire block element
- classesSep
- Class(es) for separating
<span>
- failsafe
- Version management
The Failsafe interface is heading for version management of globally distributed Lua modules. It enables modules equipped with this interface to
- ensure, that a library module required by a template or another module available as local copy does support certain functionality, or complain if not.
- administrate global updating and linking of module codes via Wikidata.
The Failsafe interface is present both at template level and for direct Lua access.
The functions in detail are (not all supported yet completely by every library):
Value | Result | current |
---|---|---|
nothingfalse
|
local version ID | »2023-10-25« |
Minimal version | version ID required at least date in ISO format It will be compared whether the current local implementation matches this version or later.
|
|
wikidata
|
version ID of global upstream
|
»2023-10-25« |
item
|
ID of the Wikidata item
|
Q100938243
|
~
|
Corresponding version ID locally and registered at Wikidata
|
»« |
@
|
Is the current (module) page linked correctly with Wikidata item?
|
|
The return value is in template programming empty or under Lua false , otherwis a non-empty string as described.
|
Accessibility
BearbeitenElements can be distinguished and navigated by screenreaders.
Functions for Lua modules (API)
BearbeitenAll functions described above can be used by other modules per require()
:
local lucky, HorizontalList = pcall( require, "Module:Vorlage:Auflistung" )
if type( HorizontalList ) == "table" then
HorizontalList = HorizontalList.HorizontalList()
else
-- error case; HorizontalList contains message
return "<span class=\"error\">" .. HorizontalList .. "</span>"
end
Subsequently there are available:
- HorizontalList.f( all, altogether, apart, frame )
- Generate horizontal list from wikitext.
all
– string, with wikitext; each line starting with one of*
or#
altogether
– boolean, ifnowrap
applied around each regular itemapart
– string, for separating<span>
between items, if desiredframe
– object, if available
- Returns: string
- HorizontalList.fiat( all, advance, altogether, apart, frame )
- Generate horizontal list from table.
all
– table, with sequence of items.- Each item is a string or a
mw.html
object.
- Each item is a string or a
advance
– boolean, if<ol>
requestedaltogether
– boolean, ifnowrap
applied around each regular itemapart
– string, for separating<span>
between items, if desiredframe
– object, if available
- Returns: string
- HorizontalList.first( arglist )
- Configuration of CSS environment
arglist
– table, with optional configuration assignments; components:- styles
- TemplateStyles page
- string, with page name
mw.title
object.
- classesBlock
- class(es) for entire block element
- string, with class(es)
- table, with components as string
- classesSep
- class(es) for separating
<span>
- string, with class(es)
- table, with components as string
- HorizontalList.failsafe( atleast )
-
- atleast
- optional; see above
- Returns: string or boolean
Usage
BearbeitenGeneral library; no limitations.
Dependencies
BearbeitenNone.