Difference between revisions of "Template:Set list"

From SNIC Documentation
Jump to: navigation, search
(Created page with "<noinclude> This template takes a property name and a list of values (default comma separated), and will generate an equal number of <nowiki> </nowiki> s...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
This template takes a property name and a list of values (default comma separated), and will generate an equal number of <nowiki>[[property name::value| ]]</nowiki> style assignments to that property. Line breaks in value lists are ignored, and can be safely used to break apart overly long lists. No code will be generated if {{{2}}} is empty/unassigned. Use ''sep'' (optional named parameter) to use an alternative list separator. Use ''glue'' (optional named parameter, replace_e compatible) insert additional wikitext between assignments. Use ''quiet''=true to not generate any visible text.   
+
This template takes a property name and a list of values (default semicolon separated), and will generate an equal number of <nowiki>[[property name::value| ]]</nowiki> style assignments to that property. Line breaks in value lists are ignored, and can be safely used to break apart overly long lists. No code will be generated if {{{2}}} is empty/unassigned. Use ''sep'' (optional named parameter) to use an alternative list separator. Use ''glue'' (optional named parameter, replace_e compatible) insert additional wikitext between assignments. Use ''quiet''=true to not generate any visible text.   
  
 
Example:
 
Example:
 
  <nowiki>
 
  <nowiki>
  {{set list|resource|kappa, matter, neolith|quiet=true}}
+
  {{set list|resource|kappa; matter; neolith|quiet=true}}
  {{set list|office|House G, Room 159; Linköpings Universitet; SE-581 83 Linköping|sep=;|glue=\n:}}</nowiki>
+
  {{set list|office|House G, Room 159; Linköpings Universitet; SE-581 83 Linköping|glue=\n:}}</nowiki>
  
  
</noinclude><includeonly>{{#if: {{{2|}}}|{{left brackets}}{{{1}}}::{{#replace_e: {{#replace_e: {{{2}}}|\n|}}|{{{sep|,}}}|{{#ifeq: {{{quiet}}}|true|{{pipe}} }}{{right brackets}}{{{glue|}}}{{left brackets}}{{{1}}}::}}{{#ifeq: {{{quiet}}}|true|{{pipe}} }}{{right brackets}}}}</includeonly>
+
</noinclude><includeonly><onlyinclude>{{#if: {{{2|}}}|{{left brackets}}{{{1}}}::{{#replace_e: {{#replace_e: {{{2}}}|\n|}}|{{{sep|;}}}|{{#ifeq: {{{quiet}}}|true|{{pipe}} }}{{right brackets}}{{{glue|}}}{{left brackets}}{{{1}}}::}}{{#ifeq: {{{quiet}}}|true|{{pipe}} }}{{right brackets}}}}</onlyinclude></includeonly>

Latest revision as of 10:26, 8 July 2011

This template takes a property name and a list of values (default semicolon separated), and will generate an equal number of [[property name::value| ]] style assignments to that property. Line breaks in value lists are ignored, and can be safely used to break apart overly long lists. No code will be generated if {{{2}}} is empty/unassigned. Use sep (optional named parameter) to use an alternative list separator. Use glue (optional named parameter, replace_e compatible) insert additional wikitext between assignments. Use quiet=true to not generate any visible text.

Example:

 {{set list|resource|kappa; matter; neolith|quiet=true}}
 {{set list|office|House G, Room 159; Linköpings Universitet; SE-581 83 Linköping|glue=\n:}}