Module:Format TemplateData/doc
Jump to navigation
Jump to search
This is the documentation page for Module:Format TemplateData
![]() | This module depends on the following other modules: |
Format TemplateData
' – Module with auxilary functions for template documentation, especially by TemplateData.
Core functionality is improved presentation on documentation pages.
Functions for templates
Details
- f
- Improve TemplateData-presentation; used in Template:Format TemplateData
- Parameters of template transclusion environment (all optional):
- 1
- JSON string or
<templatedata>
object - JSON
- JSON string
- (precedes 1)
- Transition from
<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. - TOC
1
– Insert table of contents after general purpose descriptions; but before parameter list, if present- lang
- Language code according to ISO 639 etc.
- lazy
1
– Presentation only, do not generate an effective data block- For general method descriptions.
- debug
1
– developer mode- source
1
– show effective JSON source text (after template expansion) for debugging
- Parameters of
#invoke
for particular project adaption (all optional):- lang
- Language code according to ISO 639 etc.
- debug
- Development mode, if provided and not equal
0
- cat
- Title of a maintenance category on invalid parameter value etc.
- Deprecated – use configuration module
- docpageCreate
- Pattern for creation of subpage names;
%s/Doku
- Deprecated – use configuration module
- docpageDetect
- Pattern for recognition of subpage names;
/Doku$
- Deprecated – use configuration module
- msgDescMiss
- Localisation: complaint text on missing
description
- Deprecated – use configuration module
- Returns: HTML code; and/or error message, probably with
class="error"
- failsafe Template:Anker
- Version management
Functions for Lua modules (API)
Some functions described above can be used by other modules:
local lucky, TemplateData = pcall( require, "Modul:Format TemplateData" )
if type( TemplateData ) == "table" then
TemplateData = TemplateData.TemplateData()
else
-- failure; TemplateData is the error message
return "<span class='error'>" .. TemplateData .. "</span>"
end
- TemplateData.failsafe(atleast)
-
- atleast
optional
nil or minimal version request or"wikidata"
- atleast
- Returns: string or false
- TemplateData.getPlainJSON(adapt)
- Reduce enhanced JSON information to MediaWiki JSON
- adapt
string, with JSON (enhanced)
- adapt
- Returns: string, with JSON (MediaWiki )
- TemplateData.test(adapt, arglist)
- Simulation of template functionality
- adapt
table,#invoke
parameters - arglist
table, template parameters
- adapt
- Returns: string
Usage
Currently focussing on one template only:
Dependencies
Configuration
A local module Module:Format TemplateData/config, if present, facilitates adaptions to the local project.
A table is expected via mw.loadData
. The following entries are optional components:
- catProblem
- Title of a maintenance category on invalid parameter value etc.
- classNoNumTOC
- Name of class for the table of contents; especially to suppress numbering.
nonumtoc
- classTable
- table with classes for the table of parameters.
{ "wikitable" }
- cssParams
- table with CSS assignments for formatting of single parameters
- cssParWrap
- table with CSS assignments for formatting of the entire parameter table
- docpageCreate
- Pattern for creation of subpage names;
%s/Doku
%s/Doku
- docpageDetect
- Pattern for recognition of subpage names;
/Doku$
/Doku$
- help*********
- Link targets for context sensitive help on details
- helpBoolean
- helpContent
- helpDate
- helpFile
- helpFormat
- Link target on help about wikitext transclusion layout
- helpLine
- helpNumber
- helpPage
- helpString
- helpTemplate
- helpURL
- helpUser
- msgDescMiss
- Localisation: complaint text on missing
description
- permit
- table with specification of properties for a single parameter; components:
- boole
- table with specification for boolean presentation
- Two components
true
andfalse
– each one table:- css
- table with CSS for this explanation of the value
- lead
true
– show explanation for0
or1
respectively preceding the valuefalse
– show explanation for0
or1
respectively following the value- show
- explanation; string or
false
to suppress
- css
- table with specifications for rendering of the parameter table; components:
- tablehead
- table with CSS for table head
- required
- table with CSS for
required
- suggested
- table with CSS for
suggested
- optional
- table with CSS for
optional
- deprecated
- table with CSS for
deprecated