Reference:TemplateData: Difference between revisions

No edit summary
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
Line 12: Line 12:
}}
}}
The extension '''TemplateData''' introduces a <code><nowiki><templatedata></nowiki></code> tag and an API which together allow editors to specify how templates should be invoked.
The extension '''TemplateData''' introduces a <code><nowiki><templatedata></nowiki></code> tag and an API which together allow editors to specify how templates should be invoked.
Not all [[mediawikiwiki:Help:TemplateData#Type_parameter|data types that can be selected]] for a parameter, have any actual effect and are treated as "unknown":
{| class="wikitable"
!Value
!Description
|-
!unknown
|standard setting
'''no visible effect'''
|-
!string
|intended for any string of plain text
'''no visible effec'''t
|-
!'''line'''
|intended for content that should be forced to stay on one line
'''Effect:'''<code>"line"</code> prevents a parameter's input box from allowing new lines
|-
!content
|The <code>"content"</code> value is intended for wikitext of page content, for example, links, images or text formatting.
'''no visible effect'''
|-
!unbalanced-wikitext
|intended for wikitext that cannot stand alone, i.e. it lacks an opening or closing tag or refers to other parts of wikitext.
'''no visible effect'''
|-
!'''wiki-page-name'''
|intended for a page name on a wiki
'''Effect: S'''hows a suggestion dropdown menu containing a list of pages on the wiki, which can be selected. Namespaces can also be defined in the search. Additionally,  it forces the input box content to stay on one line. It  doesn't prevent a non-page from being inputted.
|-
!wiki-file-name
|intended for a locally hosted file name
'''no visible effect'''
|-
!'''wiki-template-name'''
|intended for the name of a template
'''Effect:''' Shows a suggestion dropdown menu containing a list of templates, which can be selected. Additionally, it forces the input box content to stay on one line. It doesn't prevent a non-template from being inputted.
|-
!'''wiki-user-name'''
|intended for a username on a wiki
'''Effect:''' Shows a suggestion dropdown menu containing a list of actual users' names, which can be selected. Additionally, it forces the input box content to stay on one line. It doesn't prevent a non-username from being inputted.
|-
!number
|intended for numerical values, including negative values and decimals.
'''no visible effect'''
|-
!'''boolean'''
|intended for a value that is either true, false or unknown. This is intended by the [[mediawikiwiki:Special:MyLanguage/Extension:TemplateData#Param_object|manual]] to be represented by a "1", "0" or blank value.
'''Effect:''' With the <code>autovalue:0</code>,  a checkbox appears in the visual editor, which can be switched on and off.
|-
!date
|intended for a date in the YYYY-MM-DD format
'''no visible effect'''
|-
!'''url'''
|intended for a URL, with Internet protocol (e.g., "https://" or "//") included
'''Effect:''' It makes the input box display an external link icon (a square with arrow pointing out of it) in the left hand side of the box and makes the box glow red when the user clicks away without entering a URL value that includes a valid Internet protocol (e.g., "https://", "ftp://" or "//") followed by some text.
|}


{{Translation}}
{{Translation}}

Revision as of 16:31, 18 July 2023

Extension: TemplateData

all extensions

Overview
Description: Implement data storage for template parameters (using JSON)
State: stable Dependency: MediaWiki
Developer: Timo Tijhof, Moriel Schottlender, James Forrester, Trevor Parscal License: GPL v2+
Type: MediaWiki Category: Content Structuring
Edition: BlueSpice pro, BlueSpice Farm, BlueSpice Cloud Version: 4.1+
For more info, visit Mediawiki.


The extension TemplateData introduces a <templatedata> tag and an API which together allow editors to specify how templates should be invoked.

Not all data types that can be selected for a parameter, have any actual effect and are treated as "unknown":

Value Description
unknown standard setting

no visible effect

string intended for any string of plain text

no visible effect

line intended for content that should be forced to stay on one line

Effect:"line" prevents a parameter's input box from allowing new lines

content The "content" value is intended for wikitext of page content, for example, links, images or text formatting.

no visible effect

unbalanced-wikitext intended for wikitext that cannot stand alone, i.e. it lacks an opening or closing tag or refers to other parts of wikitext.

no visible effect

wiki-page-name intended for a page name on a wiki

Effect: Shows a suggestion dropdown menu containing a list of pages on the wiki, which can be selected. Namespaces can also be defined in the search. Additionally, it forces the input box content to stay on one line. It doesn't prevent a non-page from being inputted.

wiki-file-name intended for a locally hosted file name

no visible effect

wiki-template-name intended for the name of a template

Effect: Shows a suggestion dropdown menu containing a list of templates, which can be selected. Additionally, it forces the input box content to stay on one line. It doesn't prevent a non-template from being inputted.

wiki-user-name intended for a username on a wiki

Effect: Shows a suggestion dropdown menu containing a list of actual users' names, which can be selected. Additionally, it forces the input box content to stay on one line. It doesn't prevent a non-username from being inputted.

number intended for numerical values, including negative values and decimals.

no visible effect

boolean intended for a value that is either true, false or unknown. This is intended by the manual to be represented by a "1", "0" or blank value.

Effect: With the autovalue:0, a checkbox appears in the visual editor, which can be switched on and off.

date intended for a date in the YYYY-MM-DD format

no visible effect

url intended for a URL, with Internet protocol (e.g., "https://" or "//") included

Effect: It makes the input box display an external link icon (a square with arrow pointing out of it) in the left hand side of the box and makes the box glow red when the user clicks away without entering a URL value that includes a valid Internet protocol (e.g., "https://", "ftp://" or "//") followed by some text.

Discussions