Difference between revisions of "Template:Set category list"

From SNIC Documentation
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
This template takes a property name and a comma separated list of category names (without the Category: namespace prefix), and will generate an equal number of <nowiki>[[Category:name]]</nowiki> category assignments and <nowiki>[[property name::Category: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 <nowiki>{{{2}}}</nowiki> is empty/unassigned.
+
This template takes a property name and a semicolon separated list of category names (without the Category: namespace prefix), and will generate an equal number of <nowiki>[[Category:name]]</nowiki> category assignments and <nowiki>[[property name::Category: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 <nowiki>{{{2}}}</nowiki> is empty/unassigned.
  
 
Example:
 
Example:
 
  <nowiki>
 
  <nowiki>
  {{set category list|field|bioinformatics,
+
  {{set category list|field|bioinformatics;
 
  computational chemistry}}</nowiki>
 
  computational chemistry}}</nowiki>
  
</noinclude><includeonly><onlyinclude>{{#if: {{{2|}}}|{{left brackets}}{{{1}}}::Category:{{#replace: {{#replace_e: {{{2}}}|\n|}}|,|{{pipe}} {{right brackets}}{{left brackets}}{{{1}}}::Category:}}{{pipe}} {{right brackets}}
+
</noinclude><includeonly><onlyinclude>{{#if: {{{2|}}}|{{left brackets}}{{{1}}}::Category:{{#replace: {{#replace_e: {{{2}}}|\n|}}|;|{{pipe}} {{right brackets}}{{left brackets}}{{{1}}}::Category:}}{{pipe}} {{right brackets}}
{{left brackets}}Category:{{#replace: {{#replace_e: {{{2}}}|\n|}}|,|{{right brackets}}{{left brackets}}Category:}}{{right brackets}}}}</onlyinclude></includeonly>
+
{{left brackets}}Category:{{#replace: {{#replace_e: {{{2}}}|\n|}}|;|{{right brackets}}{{left brackets}}Category:}}{{right brackets}}}}</onlyinclude></includeonly>

Latest revision as of 10:27, 8 July 2011

This template takes a property name and a semicolon separated list of category names (without the Category: namespace prefix), and will generate an equal number of [[Category:name]] category assignments and [[property name::Category: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.

Example:

 {{set category list|field|bioinformatics;
 computational chemistry}}