Difference between revisions of "User:Sub4rctic/Any"

From TerraFirmaCraft Plus Wiki
Jump to: navigation, search
Line 21: Line 21:
 
<noinclude>
 
<noinclude>
  
'''<nowiki>{{User:Sub4rctic/Woods}}</nowiki>'''
+
'''<code><nowiki>{{User:Sub4rctic/Woods}}</nowiki></code>'''
 
+
 
List of all woods with < and > as PREFIX and SUFFIX, semicolon separated
 
List of all woods with < and > as PREFIX and SUFFIX, semicolon separated
  
<nowiki>{{#replace:string|search term|replacement term}}</nowiki>
+
'''<code><nowiki>{{#replace:string|search term|replacement term}}</nowiki></code>'''
 
+
 
replacement syntax
 
replacement syntax
  
<nowiki>{{#replace:{{User:Sub4rctic/Woods}}|search term|replacement term}}</nowiki>
+
'''<code><nowiki>{{#replace:{{User:Sub4rctic/Woods}}|search term|replacement term}}</nowiki></code>'''
+
 
use the woods template as the string
 
use the woods template as the string
  
<nowiki>{{#replace:{{User:Sub4rctic/Woods}}|>|<nowiki/> <nowiki/>SUFFIX}}</nowiki>
+
'''<code><nowiki>{{#replace:{{User:Sub4rctic/Woods}}|>|<nowiki/> <nowiki/>SUFFIX}}</nowiki></code>'''
 
+
 
If a space is used in the replacement term, must be nowiki'd out with self-closing tags
 
If a space is used in the replacement term, must be nowiki'd out with self-closing tags
  
<nowiki>{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX}}|<|PREFIX}}</nowiki>
+
'''<code><nowiki>{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX}}|<|PREFIX}}</nowiki></code>'''
 
+
 
nest SUFFIX replacement inside a PREFIX replacement
 
nest SUFFIX replacement inside a PREFIX replacement
  
<nowiki>{{#explode:string|delimiter|position|limit}}</nowiki>
+
'''<code><nowiki>{{#explode:string|delimiter|position|limit}}</nowiki></code>'''
 
+
 
explode syntax. Pos counted from 0
 
explode syntax. Pos counted from 0
  
<nowiki>{{#explode:{{{1}}}|,|0}}</nowiki>
+
'''<code><nowiki>{{#explode:{{{1}}}|,|0}}</nowiki></code>'''
 
+
 
Returns before comma
 
Returns before comma
  
<nowiki>{{#explode:{{{1}}}|,|1}}</nowiki>
+
'''<code><nowiki>{{#explode:{{{1}}}|,|1}}</nowiki></code>'''
 
+
 
returns string after comma
 
returns string after comma
  
<nowiki>{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX,{{#explode:{{{1}}}|,|1}}}}|<|PREFIX}}</nowiki>
+
'''<code><nowiki>{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX,{{#explode:{{{1}}}|,|1}}}}|<|PREFIX}}</nowiki></code>'''
 
+
 
after the suffix add a comma and add param 1 string after comma. Problem: leaves a comma even when there is no ",#" after item name.
 
after the suffix add a comma and add param 1 string after comma. Problem: leaves a comma even when there is no ",#" after item name.
  
<nowiki>{{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }}</nowiki>
+
'''<code><nowiki>{{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }}</nowiki></code>'''
 
+
 
if syntax
 
if syntax
  
<nowiki>{{#if: {{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}</nowiki>
+
'''<code><nowiki>{{#if: {{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}</nowiki></code>'''
 
+
 
if param 1 string after comma delimiter is not empty, return ", string", and if it is, return nothing
 
if param 1 string after comma delimiter is not empty, return ", string", and if it is, return nothing
  
<nowiki>{{#replace: {{#replace: {{User:Sub4rctic/Woods}}|>|SUFFIX{{#if:{{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}}}|<|PREFIX}}</nowiki>
+
'''<code><nowiki>{{#replace: {{#replace: {{User:Sub4rctic/Woods}}|>|SUFFIX{{#if:{{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}}}|<|PREFIX}}</nowiki></code>'''
 
+
 
so if param 1 has a comma then number, a comma and the number will be placed after SUFFIX. If not, then nothing will be placed after SUFFIX
 
so if param 1 has a comma then number, a comma and the number will be placed after SUFFIX. If not, then nothing will be placed after SUFFIX
  

Revision as of 08:07, 7 October 2019



{{User:Sub4rctic/Woods}} List of all woods with < and > as PREFIX and SUFFIX, semicolon separated

{{#replace:string|search term|replacement term}} replacement syntax

{{#replace:{{User:Sub4rctic/Woods}}|search term|replacement term}} use the woods template as the string

{{#replace:{{User:Sub4rctic/Woods}}|>|<nowiki/> <nowiki/>SUFFIX}} If a space is used in the replacement term, must be nowiki'd out with self-closing tags

{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX}}|<|PREFIX}} nest SUFFIX replacement inside a PREFIX replacement

{{#explode:string|delimiter|position|limit}} explode syntax. Pos counted from 0

{{#explode:{{{1}}}|,|0}} Returns before comma

{{#explode:{{{1}}}|,|1}} returns string after comma

{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX,{{#explode:{{{1}}}|,|1}}}}|<|PREFIX}} after the suffix add a comma and add param 1 string after comma. Problem: leaves a comma even when there is no ",#" after item name.

{{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }} if syntax

{{#if: {{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}} if param 1 string after comma delimiter is not empty, return ", string", and if it is, return nothing

{{#replace: {{#replace: {{User:Sub4rctic/Woods}}|>|SUFFIX{{#if:{{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}}}|<|PREFIX}} so if param 1 has a comma then number, a comma and the number will be placed after SUFFIX. If not, then nothing will be placed after SUFFIX

{{#switch: comparison string
 | case = result
 | case = result
 | #default = default result
}}

Switch syntax