Wikipedia:Lua/Modul/Vorlage:Auflistung/en

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
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

[Quelltext 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):

Parameter
Value Result current
nothing
false
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.

  • empty, if minimal version not achieved
  • 2001-01-01 → »2023-10-25«
  • 2099-01-01 → »«
wikidata version ID of global upstream
  • version ID at Wikidata
  • local, if not found there
»2023-10-25«
item ID of the Wikidata item
  • empty if not defined
Q100938243
~ Corresponding version ID locally and registered at Wikidata
  • empty, if up to date
  • version ID at Wikidata, if not equal
»«
@ Is the current (module) page linked correctly with Wikidata item?
  • empty, if linked to the item which is supposed
  • Iitem ID, if not
»Q100938243«
The return value is in template programming empty or under Lua false, otherwis a non-empty string as described.

Accessibility

[Quelltext bearbeiten]

Elements can be distinguished and navigated by screenreaders.

Functions for Lua modules (API)

[Quelltext bearbeiten]

All 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.
  • allstring, with wikitext; each line starting with one of * or #
  • altogetherboolean, if nowrap applied around each regular item
  • apartstring, for separating <span> between items, if desired
  • frame – object, if available
Returns: string
HorizontalList.fiat( all, advance, altogether, apart, frame )
Generate horizontal list from table.
  • alltable, with sequence of items.
    • Each item is a string or a mw.html object.
  • advanceboolean, if <ol> requested
  • altogetherboolean, if nowrap applied around each regular item
  • apartstring, for separating <span> between items, if desired
  • frame – object, if available
Returns: string
HorizontalList.first( arglist )
Configuration of CSS environment
  • arglisttable, 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

General library; no limitations.

Dependencies

[Quelltext bearbeiten]

None.