| Vorlagenprogrammierung | Diskussionen | Lua | Test | Unterseiten | |||
| Modul | Deutsch | English | Modul: | Dokumentation | |||
TemplateData – Module with auxilary functions for template documentation, especially by TemplateData.
Core functionality is improved presentation on documentation pages.
For presentation of template depiction in VisualEditor agreement was made to abandon all markup and clickable links, permitting all tooltips in all environments. Basically this is reasonable, albeit tooltips with markup and clickable links are supported as HTML application for decades now and JavaScript is present anyway when VisualEditor is used.
This state is indefensible.
In addition to the simple syntax supported by MediaWiki and presented in the VisualEditor, the following features can be added to the JSON code for the template documentation page. They affect the elements classified as InterfaceText, but are only useful for description fields.
Wikilinks (internal format)
External links (URL format)
Apostrophs ' for italic and bold
HTML entities
< > & " and all numeric formats.HTML tags
", which conflicts with the JSON syntax. It is important to make sure that ' is used, which can be a problem with template transclusions.<noexport> … </noexport>
Templates
JSON= is used, templates can be distributed anywhere in the JSON code. However, the expanded syntax might collide with the JSON syntax.More effects
#templatedata:parameter-name.params:{} is not required.Two aspects were found to be particularly disturbing in 2013–2017:
The general comments show that MediaWiki only regards the presentation of TemplateData specifications in the VisualEditor as important. However, someone has to program and maintain the templates and someone needs to generate the template description and make it manageable beside the functionality in the VisualEditor form, but that is beyond ken.
<templatedata> elements.<templatedata> element. This is done for the export and corresponds to the MediaWiki guidelines.
<templatedata> is suppressed, and those pages do not appear separately in Special:PagesWithProp/templatedata.<templatedata> object<templatedata> objects with pipe symbols needs special attention: Pipes are to be represented as {{!}}, on double curly brackets one should be encoded by HTML entity.1 – Insert table of contents after general purpose descriptions; but before parameter list, if present1 – Presentation only, do not generate an effective data block1 – developer mode1 – show effective JSON source text (after template expansion) for debugging#invoke for particular project adaption (all optional):
0%s/Doku/Doku$descriptionclass="error"The Failsafe interface is heading for version management of globally distributed Lua modules. It enables modules equipped with this interface to
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 | »2026-05-06« |
| 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
|
»2026-05-06« |
item |
ID of the Wikidata item
|
Q46997995 |
~ |
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. | ||
Some functions described above can be used by other modules:
local lucky, TemplateData = pcall( require, "Modul:TemplateData" )
if type( TemplateData ) == "table" then
TemplateData = TemplateData.TemplateData()
else
-- failure; TemplateData is the error message
return "<span class='error'>" .. TemplateData .. "</span>"
end
"wikidata"#invoke parametersCurrently focussing on one template only:
A local module Module:TemplateData/config, if present, facilitates adaptions to the local project.
A table is expected via mw.loadData. The following entries are optional components:
nonumtoc{ "wikitable" }%s/Doku%s/Doku/Doku$/Doku$descriptiontrue and false – each one table:
true – show explanation for 0 or 1 respectively preceding the valuefalse – show explanation for 0 or 1 respectively following the valuefalse to suppressrequiredsuggestedoptionaldeprecated