Difference between revisions of "User:Alistaire/Template:DefsStdTemplate/doc"

From RimWorld Wiki
Jump to navigation Jump to search
(Added better examples)
 
(11 intermediate revisions by one other user not shown)
Line 6: Line 6:
 
! Parameter !! Explanation
 
! Parameter !! Explanation
 
|-
 
|-
| attribute || ''(required<sup>1</sup>):'' The attribute, e.g <parent attribute=""/>, you are describing in this row.
+
| attribute || ''(required<sup>1</sup>):'' The attribute, e.g &lt;parent attribute=""/&gt;, you are describing in this row.
 
|-
 
|-
| attributeLink || ''(optional<sup>1</sup>):'' If the attribute name isn't the same as the page you want to link to, use this parameter to choose the right link.
+
| collapseContents || ''(optional):'' Whether the contents should collapse. Starts collapsed.
 
|-
 
|-
| contents || ''(required):'' A [[User:Alistaire/Template:DefsStdContentSwitch]] -style content name. Accepted values are shown on the template page.
+
| contents || ''(optional<sup>2</sup>):'' An unformatted {{{type}}}, used for special contents cases e.g child tags.
 +
|-
 +
| examples || ''(optional):'' Adds an example column in &lt;pre/&gt;, e.g &lt;pre&gt;{{{examples}}}&lt;/pre&gt;.
 +
|-
 +
| link || ''(optional):'' Overwrites what attribute/tag links to.
 
|-
 
|-
 
| notes || ''(required):'' An explanation on the tag/attribute described in this row.
 
| notes || ''(required):'' An explanation on the tag/attribute described in this row.
Line 16: Line 20:
 
| tag || ''(required<sup>1</sup>):'' The tag, e.g <parent><tag/></parent>, you are describing in this row.
 
| tag || ''(required<sup>1</sup>):'' The tag, e.g <parent><tag/></parent>, you are describing in this row.
 
|-
 
|-
| tagLink || ''(optional<sup>1</sup>):'' If the tag name isn't the same as the page you want to link to, use this parameter to choose the right link.
+
| type || ''(required):'' A [[User:Alistaire/Template:DefsStdContentSwitch]] -style content name. Accepted values are shown on the template page.
 +
|-
 +
| typeDefault || ''(optional):'' A [[User:Alistaire/Template:DefsStdContentSwitch]] -style default value. Shows up as (default: {{{typeDefault}}}), before typeInfo.
 
|-
 
|-
|}</br>
+
| typeInfo || ''(optional):'' A [[User:Alistaire/Template:DefsStdContentSwitch]] -style extra info. Shows up as ({{{typeInfo}}}), behind typeDefault.
 +
|-
 +
|}<br/>
  
# One of attribute/attributeLink and tag/tagLink is shown.<br/></br>
+
# Only one of attribute and tag is shown.
 +
# Only shown when there's no type parameter.<br/><br/>
  
 
==Examples==
 
==Examples==
 
+
<nowiki>
 
{|
 
{|
 
! Input !! Output
 
! Input !! Output
 
|-
 
|-
| <pre>{{User:Alistaire/Template:DefsStdTemplateHeader}}
+
| <pre>{{User:Alistaire/Template:DefsStdTemplateHeader|notesDisabled=1|examplesEnabled=1}}
{{User:Alistaire/Template:DefsStdTemplate}}
+
{{User:Alistaire/Template:DefsStdTemplate|examplesEnabled=1}}
 
|}</pre>
 
|}</pre>
| {{User:Alistaire/Template:DefsStdTemplateHeader}}
+
| {{User:Alistaire/Template:DefsStdTemplateHeader|notesDisabled=1|examplesEnabled=1}}
{{User:Alistaire/Template:DefsStdTemplate}}
+
{{User:Alistaire/Template:DefsStdTemplate|examplesEnabled=1}}
 
|}
 
|}
 
|-
 
|-
| <pre>{{User:Alistaire/Template:DefsStdTemplateHeader|tag=thingDef|parents={{User:Alistaire/Template:DefsStdFormatter|ThingDefs|Defs}}}}
+
| <pre>{{User:Alistaire/Template:DefsStdTemplateHeader
{{User:Alistaire/Template:DefsStdTemplate|tag=defName|contents=string|notes=The in-script defName of this thing, referenced by recipes for example.}}
+
|tag=thingDef
{{User:Alistaire/Template:DefsStdTemplate|attribute=Name|contents=bool|notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}}
+
|parents={{User:Alistaire/Template:DefsStdFormatter|ThingDefs|Defs}}}}
 +
{{User:Alistaire/Template:DefsStdTemplate
 +
|tag=defName
 +
|type=string
 +
|notes=The in-script defName of this thing, referenced by recipes for example.}}
 +
{{User:Alistaire/Template:DefsStdTemplate
 +
|attribute=Name
 +
|type=bool
 +
|notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}}
 
|}</pre>
 
|}</pre>
| {{User:Alistaire/Template:DefsStdTemplateHeader|tag=thingDef|parents={{User:Alistaire/Template:DefsStdFormatter|ThingDefs|Defs}}}}
+
| {{User:Alistaire/Template:DefsStdTemplateHeader|tag=thingDef|parents={{User:Alistaire/Template:DefsStdFormatter|ThingDef|ThingDef}}}}
{{User:Alistaire/Template:DefsStdTemplate|tag=defName|contents=string|notes=The in-script defName of this thing, referenced by recipes for example.}}
+
{{User:Alistaire/Template:DefsStdTemplate|tag=defName|type=string|notes=The in-script defName of this thing, referenced by recipes for example.}}
{{User:Alistaire/Template:DefsStdTemplate|attribute=Name|contents=bool|notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}}
+
{{User:Alistaire/Template:DefsStdTemplate|attribute=Name|type=bool|notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}}
 
|}
 
|}
 
|-
 
|-
|}
+
|}<br/><br/>
 +
</nowiki>
 +
==See also==
 +
 
 +
*[[User:Alistaire/Template:DefsStdTemplateHeader]]

Latest revision as of 23:50, 4 April 2023

Example documentation

Parameters[edit]

Parameter Explanation
attribute (required1): The attribute, e.g <parent attribute=""/>, you are describing in this row.
collapseContents (optional): Whether the contents should collapse. Starts collapsed.
contents (optional2): An unformatted {{{type}}}, used for special contents cases e.g child tags.
examples (optional): Adds an example column in <pre/>, e.g <pre>{{{examples}}}</pre>.
link (optional): Overwrites what attribute/tag links to.
notes (required): An explanation on the tag/attribute described in this row.
tag (required1): The tag, e.g <parent><tag/></parent>, you are describing in this row.
type (required): A User:Alistaire/Template:DefsStdContentSwitch -style content name. Accepted values are shown on the template page.
typeDefault (optional): A User:Alistaire/Template:DefsStdContentSwitch -style default value. Shows up as (default: {{{typeDefault}}}), before typeInfo.
typeInfo (optional): A User:Alistaire/Template:DefsStdContentSwitch -style extra info. Shows up as ({{{typeInfo}}}), behind typeDefault.


  1. Only one of attribute and tag is shown.
  2. Only shown when there's no type parameter.

Examples[edit]

{| ! Input !! Output |- | <pre>{{User:Alistaire/Template:DefsStdTemplateHeader|notesDisabled=1|examplesEnabled=1}} {{User:Alistaire/Template:DefsStdTemplate|examplesEnabled=1}} |}</pre> | {{User:Alistaire/Template:DefsStdTemplateHeader|notesDisabled=1|examplesEnabled=1}} {{User:Alistaire/Template:DefsStdTemplate|examplesEnabled=1}} |} |- | <pre>{{User:Alistaire/Template:DefsStdTemplateHeader |tag=thingDef |parents={{User:Alistaire/Template:DefsStdFormatter|ThingDefs|Defs}}}} {{User:Alistaire/Template:DefsStdTemplate |tag=defName |type=string |notes=The in-script defName of this thing, referenced by recipes for example.}} {{User:Alistaire/Template:DefsStdTemplate |attribute=Name |type=bool |notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}} |}</pre> | {{User:Alistaire/Template:DefsStdTemplateHeader|tag=thingDef|parents={{User:Alistaire/Template:DefsStdFormatter|ThingDef|ThingDef}}}} {{User:Alistaire/Template:DefsStdTemplate|tag=defName|type=string|notes=The in-script defName of this thing, referenced by recipes for example.}} {{User:Alistaire/Template:DefsStdTemplate|attribute=Name|type=bool|notes=The tag's Name that other tags have to reference to with ParentName to get the same contents.}} |} |- |}<br/><br/>

See also[edit]