User:PerfektesChaos/js/jsonXMLutils

JavaScript gadget – several tools for JSON and XML template documentation.

Usage
Include the following lines into your common.js, global.js etc.:

Generation from scratch
At every stage in template namespace there is a button offered to create a new TemplateData JSON structure:
 * in edit mode on top of page, close to (disabled) MediaWiki button for TemplateData maintenance.
 * in view mode at the end of the page, close to categories.

If clicked, a textarea field is opened. When in edit mode, the regular edit form is searched for template programming. If characteristical parameters like  are detected, the field is intialised with a parameter list in alphabetical order.

The textarea can be filled interactively with any list of parameters, the significant part of a transclusion, a copy master, or simply a list with parameter names on single lines.

When happy, clicking the [submit] button creates a JSON pattern instead of the textarea, following the sequence in textarea.

Analyzing and pretty print
Existence of a TemplateData definition is recognized and the current JSON code may be formatted in standard format. That can be copied back to the place of definition.

Also the data will be The result, if any, is prepended as nonconformity report.
 * analyzed semantically, e.g. for invalid language codes or values of  – outdated values will be updated;
 * analyzed syntactically, e.g. for invalid JSON data types;
 * analyzed structurally, e.g. for unknown (mistyped) names of TemplateData components;

An empty schema is provided for recommended fields, if not yet present.

A button is offered
 * in edit mode on top of page, close to MediaWiki button for TemplateData maintenance.
 * in view mode at the end of the page, close to categories.

Retrieving XML pendant
Based upon TemplateData information the corresponding XML can be generated and copied into target page.

A button is available close to the button for JSON pretty print.

Vorlagenmeister
Vorlagenmeister uses XML for description of template parameters, building interactive form for filling in current parameter data since 2007.

Page view
XML code will be re-displayed with syntax highlighting on  subpages.

Lines are expected to be in monospace formatting already, by indentation of at least one space.

Source code editing
CodeEditor will be activated on  subpages.

Other languages
This gadget is prepared for multilingual support. Intermediately, programmers can override any  component by providing a respective component at:
 * If you like a version in your own language, please forward translations to me:
 * This documentation page.
 * The  mapping on top of source code.
 * Further ISO 639 language codes your translation might support.

Codes
de:User:PerfektesChaos/js/jsonXMLutils