Content deleted Content added
m 4 revisions imported from de:Wikipedia:Lua/Modul/TemplateData/en: WP:RFPI |
Added the page to Category:Module documentation pages |
||
(37 intermediate revisions by 15 users not shown) | |||
Line 1:
{{Lua|Module:Format TemplateData/config|Module:Multilingual | Module:Text| Module:WLink}}
Core functionality is improved presentation on documentation pages.
Line 52:
Two aspects were found to be particularly disturbing in 2013–2017:
# Even if no parameters at all were defined, a table head is always displayed for a table without content. Even more, this is sortable.
#* A reduction was rejected with {{Phab|
#* This ridiculous statement led to the development of this module in 2016.
# Even if the context does not permit that default values or even AutoValue specifications will be defined ever, a content-free six-line definition list is output for each individual parameter value.
#* {{Phab|
#* MediaWiki did not even deign to answer the disastrous documentation page situation.
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.
* Two years later the relatively easy task {{Phab|T125333}} has been solved by a community originated patch.
== General workflow ==
Line 72 ⟶ 73:
=== Details ===
; f {{Anker|f}}
: Improve TemplateData-presentation; used in [[Template:Format TemplateData]]
: ''Parameters of template transclusion environment (all optional):''<section begin="templatePar" />
::; 1
Line 82 ⟶ 83:
::; TOC
::: <code>1</code> – Insert table of contents after general purpose descriptions; but before parameter list, if present
::: [[:de:Wikipedia:Lua/Modul/TemplateData/TOC|Example]]
::: Language code according to [[ISO 639]] etc.
::; lazy
::: <code>1</code> – Presentation only, do not generate an effective data block
::: For general method descriptions.
::; debug
::: <code>1</code> – developer mode
::; source
::: <code>1</code> – show effective JSON source text (after template expansion) for debugging<section end="templatePar" />
: ''Parameters of'' <code>#invoke</code> ''for particular project adaption (all optional):''
::; lang
::: Language code according to [[ISO 639]] etc.
::; debug
::: Development mode, if provided and not equal <code>0</code>▼
::; cat
::: Title of a maintenance category on invalid parameter value etc.
::: '''Deprecated''' – use [[#config|configuration module]]
▲::; debug
▲::: Development mode, if provided and not equal <code>0</code>
::; docpageCreate
::: Pattern for creation of subpage names; <code>%s/Doku</code>
::: '''Deprecated''' – use [[#config|configuration module]]
::; docpageDetect
::: Pattern for recognition of subpage names; <code>/Doku$</code>
::: '''Deprecated''' – use [[#config|configuration module]]
::; msgDescMiss
::: Localisation: complaint text on missing <code>description</code>
::: '''Deprecated''' – use [[#config|configuration module]]
: ''Returns:'' HTML code; and/or error message, probably with <code>class="error"</code>
; failsafe {{Anker|failsafe}}
: Version management
== {{Anker|Lua}} Functions for Lua modules (API) ==
Line 112 ⟶ 118:
Some functions described above can be used by other modules:
<syntaxhighlight lang="lua">
local lucky, TemplateData = pcall( require, "
if type( TemplateData ) == "table" then
TemplateData = TemplateData.TemplateData()
Line 122 ⟶ 128:
; TemplateData.[[#failsafe|failsafe]](atleast)
:# atleast<br />''optional''<br />''nil'' or minimal version request or <code>"wikidata"</code>
: Returns: ''string'' or ''false''
; TemplateData.getPlainJSON(adapt)
Line 136 ⟶ 142:
== Usage ==
Currently focussing on one template only:
* [[Template:Format TemplateData]]
== {{Anker|config}} Configuration ==
A local module [[Module:Format TemplateData/config]], if present, facilitates adaptions to the local project.
A ''table'' is expected via <code>mw.loadData</code>. 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.
: <code>nonumtoc</code>
; classTable
: ''table'' with classes for the table of parameters.
: <code>{ "wikitable" }</code>
; 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; <code>%s/Doku</code>
: <code>%s/Doku</code>
; docpageDetect
: Pattern for recognition of subpage names; <code>/Doku$</code>
: <code>/Doku$</code>
; 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 <code>description</code>
; permit
: ''table'' with specification of properties for a single parameter; components:
:; boole
:: ''table'' with specification for ''boolean'' presentation
:: Two components <code>true</code> and <code>false</code> – each one ''table'':
::; css
::: ''table'' with CSS for this explanation of the value
::; lead
::: <code>true</code> – show explanation for <code>0</code> or <code>1</code> respectively preceding the value
::: <code>false</code> – show explanation for <code>0</code> or <code>1</code> respectively following the value
::; show
::: explanation; ''string'' or <code>false</code> 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 <code>required</code>
::; suggested
::: ''table'' with CSS for <code>suggested</code>
::; optional
::: ''table'' with CSS for <code>optional</code>
::; deprecated
::: ''table'' with CSS for <code>deprecated</code>
<noinclude>
[[Category:Module documentation pages]]
</noinclude>
|