User:Dodoman1000/TemplateData

From Gamepedia Help Wiki
Jump to: navigation, search
This article is a stub. You can help Gamepedia Help Wiki by expanding it.

This page contains information about TemplateData. An extention helping you using the Visual Editor.

  1. First we create a new Template, in the case for developing this guide it was: Template:TemplateData test --> See source here: Template:TemplateData test
	
[[Image:{{{1|{{{icon|}}}}}}|64x64px|link={{{2|{{{txt|}}}}}}]]

If your template is still under development, you should use the user namespace. You find more informations at Templates. Now we want to make a this newly generated template available in the visual editor.

Examples from the template

Short usage 1[edit | edit source]

{{TemplateData test| Hydra book.png |My Test}}

Template:TemplateData test

Short usage 2[edit | edit source]

{{TemplateData test| icon = Hydra book.png |name = My Test}} Template:TemplateData test

Create the TemplateData tag[edit | edit source]

Now we need to create the template data tag inside the template to make sure, that the template can be used inside the editor.

	
<templatedata>
{
    "description": "Label unsigned comments in a conversation.",
    "params": {
        "user": {
            "label": "User's name",
            "type": "wiki-user-name",
            "required": true,
            "description": "User name of person who forgot to sign their comment.",
            "aliases": ["1"]
        },
        "date": {
            "label": "Date",
            "suggested": true,
            "description": {
                "en": "Timestamp of when the comment was posted, in YYYY-MM-DD format."
            },
            "aliases": ["2"],
            "autovalue": "{{subst:#time:Y-m-d}}"
        },
        "year": {
            "label": "Year",
            "type": "number"
        },
        "month": {
            "label": "Month",
            "inherits": "year"
        },
        "day": {
            "label": "Day",
            "inherits": "year"
        },
        "comment": {
            "required": false
        }
    },
    "sets": [
        {
            "label": "Date",
            "params": ["year", "month", "day"]
        }
    ],
    "maps": {
        "ExampleConsumer": {
            "foo": "user",
            "bar": ["year", "month", "day"],
            "quux": [
                "date",
                ["day", "month"],
                ["month", "year"],
                "year"
            ]
        }
    }
}
</templatedata>

A prototype to copy[edit | edit source]