Jump to content

Help talk:TemplateData

Add topic
From mediawiki.org
Latest comment: 18 days ago by Valerio Bozzolan in topic Storing and exposing an arbitrary JSON?
This page is for discussing changes to the documentation page at Help:TemplateData. For changes to TemplateData features, see Extension talk:TemplateData.

Bear in mind that this is the wrong place to post general support questions.

If you need help with MediaWiki, use one of these channels instead:

  • For technical questions related to non-Wikimedia MediaWiki installations, use the Support desk
  • Alternatively, you can use the mailing list

Further options for contacting appropriate people can be found at Communication .

LUA parameters in Template Data ?

[edit]

Following discussion -> Project:Support_desk#should_the_Template_Data_panel_show_also_the_LUA_parameters_? i have no clear idea about the response: i think the JSON of the Template should hold the description of the LUA interpreted parameters, shouldn't it ? --Christian 🇫🇷 FR 🚨 (talk) 15:47, 22 January 2025 (UTC)Reply

Question about spaces in format strings

[edit]

I tried to correct what I perceived as a mistake in a format string example but it was reverted so clearly there’s something I didn’t understand.

In the example “Pipe characters at the end of the previous line”, the format string {{_|\n _______________ = _}} is said to give the following result:

{{Foo|
  bar            = baz|
  longparameter  = quux}}{{Bar}}

My issue is that in the string, there is only 1 space before the argument name, but in the result there are 2. What confuses me more is that, in the last example, the format string \n{{_ |\n _______________ = _}} gives:

{{Foo |
  bar            = baz |
  longparameter  = quux}}
{{Bar}}

where there are 2 spaces in both cases.

So which example is correct, which one is not? Or is there something I’m missing? Cheers. (I’m pinging @Jdforrester (WMF) as they’re the one who reverted my edit) — Danÿa (talk) 15:37, 26 August 2025 (UTC)Reply

The padding is provided by the _ character; the simple space means "always add this space regardless of context", which is not what happens. Jdforrester (WMF) (talk) 15:59, 26 August 2025 (UTC)Reply
Ok so if there is at least one space here after the \n, the line will always be indented with exactly 2 spaces? — Danÿa (talk) 16:29, 26 August 2025 (UTC)Reply

Storing and exposing an arbitrary JSON?

[edit]

In theory, can a crazy person use TemplateData to store an arbitrary JSON information like this in a specific page?

{
    "loveDinosaurs": true,
    "preferredArtworks": [
       "Monna Lisa",
       "Dunno"
    ],
}

So, is it possible later to retrieve such JSON using an API from that page?

(I'm asking because I'm exploring c:User:Valerio_Bozzolan/Category_Structured_Data#Storing_data lol - but may be useful for other thigns) Valerio Bozzolan (talk) 21:30, 1 August 2026 (UTC)Reply