This adds a TemplateData manager to the edit page in the Template
namespace.
If a <templatedata> tag already exists, the tool will parse it and
display it in a visual interface that the user can then manipulate in
their own language. If there is no <templatedata> tag, the dialog will
appear empty and allow users to add and tweak their desired template
parameter data.
The tool also allows rudimentary parameter import, which picks up the
parameters from a current template into the GUI to make the user's life
easier when producing TemplateData.
The template documentation editor feature is off by default. To enable it
use $wgTemplateDataUseGUI = true in LocalSettings.
Bug: 50436
Change-Id: I863a8199c0b08cc52b320ed00dcba912dd2aeefc
InterfaceText now defaults to null instead of {en:""} which
was awkward to deal with in the frontend.
As specified:
- label is InterfaceText
- type is a string and must be a one of the recognized types
Updated example for the hypothetical variant of Template:Unsigned
and removed other no longer needed example.
HTML output has been revised per conversation with Trevor,
James and Timo:
- Not sortable.
- Add label to html output.
- Aliases in the main parameter column (one per line),
but muted in styling.
- Add type to html output.
The css module styles content from the server, not content
generated by javascript. Moved module to position => top to
fix flash of unstyled content.
Change-Id: I16d3f9e460c5513935b9b55fe4cec0092b38e6c2
* Add unit tests for all types of invalid input we check for.
* Add unit tests for all types of input we expand or otherwise
normalise.
* Implement InterfaceText expansion/normalisation.
* Fix bug that caused a string value in the root description property
to be considered invalid (it only accepted an object, it should
accept both).
Change-Id: I5a15080f1f924451a9dde8af96ea2922011981ec
Registers a parser tag <templatedata> that should have a JSON
blob as content. The blob is then validated and normalised when
MediaWiki parses the page (e.g. during save and preview).
If there are validation errors, the save is aborted from the
extension hook and an error is displayed.
If all goes well, the normalised blob is stored in the database
(which can be retrieved through the API). And an HTML
representation of the template parameters is returned to the
wikitext parser to show where the <templatedata> was in the page.
The blob format is specified in spec.templatedata.json and
is validated in TemplateDataBlob::parse.
Bug: 44444
Change-Id: Icf305892a9512545a63f5a5280cc0d340c61585f