User:PerfektesChaos/js/WikiSyntaxTextMod/flow/template
WikiSyntaxTextMod → Syntax polishing → Step 3
The third step of syntax polishing covers all issues in context of template and page transclusion. This is anything in curly brackets {{
…}}
as well as parser functions and similar syntax elements.
Formatting
[edit]- A third
{
indicates a parameter value; this sequence will be ignored. - Spaces between
{{
and identifier are removed. - Many parser functions can be detected by identifier terminated by
:
(looks like containing a colon).- For DEFAULTSORT and DISPLAYTITLE or their equivalences special treatment is triggered.
- Names of parser functions must not contain spaces but underscore; in return no percent sign or brackets.
- Other parser functions, variables and their localization are identified by positive list.
- If parser functions or variables have been detected they are turned into common and unique upcase spelling.
- If it is obviously neither a parser function nor a variable the identifier is treated as name of a template (or other transcluded page).
- It is proofed to be a template name if the identifier is beginning before colon with the name space designator
template:
or localized counterpart. Such name space prefix will be removed. - Names of templates are decoded like a wikilink.
- Under project specific conditions the first character is capitalized or downcased.
- If it is a well known standard template in general or for the current project appropriate action is taken.
- If there is a user defined wikilink modification or respective user defined template modification this will be executed.
- If there is a need the name of the template is protected against undesired changes.
Inner analysis
[edit]Especially if there is special interest in a template, well known or user defined or by project standardmäßig subject to changes and evaluation, the template is split syntactically and parameters are evaluated.
- Nested templates in template are always separated.
- During parameter analysis wikilinks get separated, which enables assignment of pipe symbols
|
to wikilinks or parameter separation. - As result of parameter analysis a list is available which parameters with which name and value is present and how they are formatted in detail by spaces and new lines.
DISPLAYTITLE
[edit]In main space pages (articles) an entirely redundant {{DISPLAYTITLE:
…}}
or localized variant is removed. This happens only if the value is completely identical with the page title and there are no special characters which could be interpreted syntactically.
Standard templates
[edit]While every project might use a different definition for some template types a default behaviour is provided:
Sister projects
[edit]Commons
, Commonscat
as well as Wikisource
and Wiktionary
etc. are standardized and simplified.
Depending on availability in project a combination of Commons
and Category:
is turned into Commonscat
or Commons category
etc.
ISSN
[edit]In a Template:ISSN invalid number format is adjusted and remaining bad data causes an error message.
Code parameters
[edit]For all wiki projects template parameters with the following names will be checked (upper and lower case doesn’t matter):
- DOI, ISBN, ISSN, PMID, VIAF (in future: LCCN)
The formal permissibility is tested; if possible and necessary the value will be formatted.
- Those algorithms are subject to further extension.
[ German page ]