Jump to content

Module:TemplateDataGenerator/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Cp from dewiki
Clean up
Line 1: Line 1:
'''<code>Module:TemplateDataGenerator</code>''' – Module for generation of a skeleton for TemplateData from the parameter usage within template programming.
{{LuaModuleDoc}}
<onlyinclude>'''<code>{{ns:10}}:TemplateDataGenerator</code>''' – Module for generation of a skeleton for TemplateData from the parameter usage within template programming.
== From wikitext ==
== {{Anker|{{ns:10}}}} Functions for Templates ==
; f
; f
: Trigger analysis of template around (base page).
: Trigger analysis of template around (base page).
Line 10: Line 9:
=== Template wrapping ===
=== Template wrapping ===
The module is supposed to be wrapped for convenience into something like a template
The module is supposed to be wrapped for convenience into something like a template
<nowiki><onlyinclude><includeonly>{{#invoke:{{ns:10}}:TemplateDataGenerator|f}}</includeonly></onlyinclude></nowiki>
<nowiki>{{#invoke:{{ns:10}}:TemplateDataGenerator|f}}</nowiki>
Documentation
Documentation
That template may be “transcluded” with one parameter: '''sort''' alias&nbsp;'''1'''&nbsp;– if that is provided with the value <code>1</code>, parameter list will be sorted in alphabetical order.
That template may be transcluded with one parameter: '''sort''' alias&nbsp;'''1'''&nbsp;– if that is provided with the value <code>1</code>, parameter list will be sorted in alphabetical order.


=== Productive usage ===
=== Productive usage ===
When editing a template (documentation) page, users are supposed to insert the following line, where TemplateData shall appear:
When editing a template (documentation) page, users are supposed to insert the following line, where TemplateData shall appear:
<code><nowiki>{{subst:TemplateDataGenerator}}</nowiki></code>
<code><nowiki>{{subst:TemplateDataGenerator}}</nowiki></code>
After click on [Preview], the generated lines are displayed and can be inserted by copy & paste to replace the temporary “transclusion”.
After click on [Preview], the generated lines are displayed and can be inserted by copy & paste to replace the temporary transclusion.


If forgotten to remove on saving, <code>subst</code> comes into effect and the plain lines are stored into source text. Next time someone will do the cleanup.
If forgotten to remove on saving, <code>subst</code> comes into effect and the plain lines are stored into source text. Next time someone will do the cleanup.


== {{Anker|Lua}} Functions for Lua modules ==
== Functions for Lua modules ==
; getBlock( about, ahead, alphabetical )
; getBlock( about, ahead, alphabetical )
: Trigger analysis of template like '''f''' but from Lua call.
: Trigger analysis of template like '''f''' but from Lua call.
Line 27: Line 26:
:* ''ahead'' – string, number or nil; namespace (Template:)
:* ''ahead'' – string, number or nil; namespace (Template:)
:* ''alphabetical'' – boolean or nil; sort parameter list
:* ''alphabetical'' – boolean or nil; sort parameter list

== Usage ==
* [[{{ns:10}}:TemplateDataGenerator]]

== Dependencies ==
None.

[[Kategorie:Wikipedia:Lua/Modul/Dokumentation|Vorlage:TemplateDataGenerator/en]]

Revision as of 02:57, 23 February 2019

Module:TemplateDataGenerator – Module for generation of a skeleton for TemplateData from the parameter usage within template programming.

From wikitext

f
Trigger analysis of template around (base page).
  • No parameters on #invoke.
  • Yields block to be inserted by copy&paste.

Template wrapping

The module is supposed to be wrapped for convenience into something like a template

{{#invoke:{{ns:10}}:TemplateDataGenerator|f}}
Documentation

That template may be transcluded with one parameter: sort alias 1 – if that is provided with the value 1, parameter list will be sorted in alphabetical order.

Productive usage

When editing a template (documentation) page, users are supposed to insert the following line, where TemplateData shall appear:

{{subst:TemplateDataGenerator}}

After click on [Preview], the generated lines are displayed and can be inserted by copy & paste to replace the temporary transclusion.

If forgotten to remove on saving, subst comes into effect and the plain lines are stored into source text. Next time someone will do the cleanup.

Functions for Lua modules

getBlock( about, ahead, alphabetical )
Trigger analysis of template like f but from Lua call.
  • about – string; page title related to template code on base page
  • ahead – string, number or nil; namespace (Template:)
  • alphabetical – boolean or nil; sort parameter list