Jump to content

Template:Content Patcher example: Difference between revisions

From Stardew Valley Wiki
imported>Pathoschild
create template to hide {{#tag]} complexity on modding pages
 
imported>Pathoschild
remove {{#tag:nowiki}} (doesn't work since parameters are parsed before they're received by the template)
 
Line 1: Line 1:
{{#tag:syntaxhighlight|
{{#tag:syntaxhighlight|
{
{
     "Format": "{{Content Patcher version}}",{{#tag:nowiki|{{{content|{{{1}}}}}}}}}<!--account for newline at start & end of parameter-->
     "Format": "{{Content Patcher version}}",{{{content|{{{1}}}}}}}<!--account for newline at start & end of parameter-->
|lang=json}}<noinclude>
|lang=json}}<noinclude>
{{{{FULLPAGENAME}}/doc}}</noinclude>
{{{{FULLPAGENAME}}/doc}}</noinclude>

Latest revision as of 19:03, 1 February 2025

{
    "Format": "2.8.0",{{{1}}}}

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).