Template:Content Patcher example/doc: Difference between revisions
Appearance
imported>Pathoschild create docs for parent page |
imported>Pathoschild rewrite to use <nowiki> consistently (to avoid confusion if someone edits an example later to use tokens) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
This template outputs an example [[Modding:Content Patcher|Content Patcher]] <samp>content.json</samp> structure with [[Template:Content Patcher version|the latest <samp>Format</samp> version]]. | This template outputs an example [[Modding:Content Patcher|Content Patcher]] <samp>content.json</samp> structure with [[Template:Content Patcher version|the latest <samp>Format</samp> version]]. | ||
==Usage== | ===Usage=== | ||
Just call the template with the top-level Content Patcher fields you want to display (except <samp>Format</samp>). These should be indented once with four spaces. | Just call the template with the top-level Content Patcher fields you want to display (except <samp>Format</samp>). These should be indented once with four spaces. | ||
For example, this template usage: | For example, this template usage: | ||
<pre>{{Content Patcher example| | <pre>{{Content Patcher example|<nowiki> | ||
"Changes": [ | "Changes": [ | ||
{ | { | ||
| Line 16: | Line 16: | ||
} | } | ||
] | ] | ||
}}</pre> | </nowiki>}}</pre> | ||
Will produce this code example: | Will produce this code example: | ||
{{Content Patcher example| | {{Content Patcher example|<nowiki> | ||
"Changes": [ | "Changes": [ | ||
{ | { | ||
| Line 25: | Line 25: | ||
"Target": "Data/animationDescriptions", | "Target": "Data/animationDescriptions", | ||
"Entries": { | "Entries": { | ||
"pufferbob_sleep": "50/50/50" | "pufferbob_sleep": "50/50/50" | ||
} | } | ||
} | } | ||
] | ] | ||
}} | </nowiki>}} | ||
===Escape MediaWiki syntax=== | |||
Note that the example above includes <code><nowiki></code>. That just prevents MediaWiki from mangling the code if it has wiki syntax like <code><nowiki>{{</nowiki></code> (which is common in Content Patcher examples). | |||
<includeonly> | <includeonly> | ||
Latest revision as of 19:13, 1 February 2025
Description
This template outputs an example Content Patcher content.json structure with the latest Format version.
Usage
Just call the template with the top-level Content Patcher fields you want to display (except Format). These should be indented once with four spaces.
For example, this template usage:
{{Content Patcher example|<nowiki>
"Changes": [
{
"Action": "EditData",
"Target": "Data/animationDescriptions",
"Entries": {
"pufferbob_sleep": "50/50/50"
}
}
]
</nowiki>}}
Will produce this code example:
{
"Format": "2.8.0",
"Changes": [
{
"Action": "EditData",
"Target": "Data/animationDescriptions",
"Entries": {
"pufferbob_sleep": "50/50/50"
}
}
]
}
Escape MediaWiki syntax
Note that the example above includes <nowiki>. That just prevents MediaWiki from mangling the code if it has wiki syntax like {{ (which is common in Content Patcher examples).