Wikiup:Lua/Modul/TemplateData/Global/en

aus Wikipedia, der freien Enzyklopädie
Vorlagenprogrammierung Diskussionen Lua Test Unterseiten
Modul Deutsch English

Modul: Dokumentation

Using the plug-in global a multilingual documentation for an international useful standard template might be shared between projects.

The parameter set should be the same among the various wiki projects, or only slight differences might occur.

Parameters of the TemplateData formatting template

Instead of the usual parameter JSON= a special one is to be provided:

  • Global=

The identifier is specifying a resource in the global repository.

Furthermore necessary local adaptions may be defined by another parameter:

  • Local=JSON code

Global repository

  • The project Commons: (Wikimedia Commons) is expected, and currently in Data: namespace only.
  • There a top level page Commons:Data:TemplateData is presumed, if no explicit identifier precedes.
  • If no explicit “file extension” terminates, the .tab format will be assumed; that is “Tabular Data”.

Table format

The description of the entire table outlines the expected template and links to the related Wikidata entry.

Other formal components (license etc.) meet the usual habits.

The data section specifies mainly the particular template parameters.

The data schema is supposed to define most of the following fields, if required:

name type Remark
name string mandatory
label localized
description localized
type string
required boolean
suggested boolean
default localized
example localized
aliases string
  • aliases is supposed to be a list of parameters separated by pipe symbols |.
  • deprecated must be of type localized, differing from MediaWiki TemplateData.
    The two values 0 and 1 e.g. in an und language would be converted into boolean.
    deprecated is exceptional for the global description of a stable template, but might happen one day when some dramatic change arrives.
  • autovalue and inherits as well as style are not expected but possible.

Other than with the JSON objects implemented in MediaWiki TemplateData, where the parameters result in a set (associative, map) in arbitrary sequence, here an Array of parameter objects is used. That guarantees exactly the given order of parameters.

The following rules apply:

  • name is the name of a single template parameter.
  • All other identifiers correspond to the common TemplateData attributes.
  • If elements of type localized or string shall not be specified for this parameter, the value null may be assigned.
  • The number of assigned fields must be exactly the same as defined in schema for all entries. The list might be padded by null items.
  • Currently no string is permitted to be longer than 400 characters, which is suitable for tooltips in a VisualEditor form.

The parameter name |, which is impossible in template programming, has a special meaning:

  • It defines the template in total.
  • The description is the purpose description for transclusion users.
  • The type specifies the source text format (block/inline).

Local adaptions

By the parameter Local= of the TemplateData formatting template all global settings may be overwritten locally.

The value is a JSON formatted string in the same format as parameter JSON=, but defines only properties which shall differ locally.

For the parameter list params the following special rules apply:

  • It is an Array of objects like in the global table.
  • Only the real template parameters are listed here.
  • Rather than as named associative component every entry contains one or two of string values global and/or local.
global local Meaning
string n/a Assign the remaining properties to the parameter which is globally specified by the same name value.
string string Rename that global parameter accordingly.
string false Remove this global parameter definition from local list.
n/a string Insert a local parameter at this point into list.

The sequence in Array defines order in presentation.

For the combination with definitions already present from global data the following rules apply:

  • If no value has been assigned, use the local value.
  • If an atomic (string/boolean) global value is present, it will be overwritten by local value.
  • If a localized has been provided, the local value shall be of type localized as well. Present language components will be overwritten, additional language components will be added.

Implementation

Inspiration

en:User:Yurik