User:Simant/Sandbox

{{iBox/{{#switch:{{{BoxType|Row}}}|Box=Box||Row=Row}} |{{{label|}}} |{{#arraymap:|{{{LineDelim|,}}}|__VarItem__|{{#vardefine:VarData|{{#regex:{{#explode:__VarItem__|~}}|%{{#var:Media}}$%| }}}}{{#if:{{#var:VarData}}|{{#if:{{{RegexValueCondition|}}}|{{#if:{{#regex:{{{RegexValueCondition}}}|%^\^%}}|{{#regex:{{#var:VarData}}|%({{{RegexValueCondition}}})%}} }}}}{{#arraymap:{{#var:VarData}}|{{{SameLineDelim|/}}}|__VarDataItem__|{{#vardefine:ShowItem|false}}{{#vardefine:VarDataItem|{{#replace:{{#regex:__VarDataItem__|%\[\[.*\]\]%|$1}}|{{!}}|;}}}}{{#if:{{{RegexLineCondition|}}}|{{#if:{{#regex:{{#explode:__VarDataItem__|;|0}}|%^({{{RegexLineCondition}}})$%}}|{{#vardefine:ShowItem|true}}}}|{{#if:{{#explode:__VarDataItem__|;|0}}|{{#vardefine:ShowItem|true}}}}}}{{#ifeq:{{#var:ShowItem}}|true|{{#if:{{{PrependText|}}}|{{{PrependText}}}}}{{#vardefine:ItemValue|{{#regex:{{#explode:__VarDataItem__|;|0}}|%({{{RegexValueCondition|}}})%| }}}}{{#if:{{#explode:__VarDataItem__|;|1}}|{{#vardefine:ItemDisplayName|{{#explode:__VarDataItem__|;|1}}}}|{{#vardefine:ItemDisplayName|{{#explode:{{#var:ItemValue}}|#}}}}}}{{#if:{{{SemanticPropertyName|}}}|{{#set:{{{SemanticPropertyName}}}={{#var:ItemValue}}{{{SemanticPropertyUnit|}}}}}}}{{#switch:{{#explode:{{{linkOptions|default}}}|:|0}} |Semantic Unit={{{SemanticPropertyName}}}::{{ |Form |Wikipedia |default={{#ifexpr:{{#ask:#}}|format=count}}>0|{{#var:ItemDisplayName}}|{{#switch:{{#explode:{{{linkOptions|default}}}|:|0}} |Form={{#formlink:form={{#explode:{{{linkOptions}}}|:|1}} |link text={{#var:ItemDisplayName}} |target={{#explode:{{#var:ItemValue}}|#}} |tooltip=Click here to create this page. }}                                  |Wikipedia={{#var:ItemDisplayName}}} |default={{#var:ItemDisplayName}}}}}} |none={{#var:ItemDisplayName}}}}{{#if:{{{AppendText|}}}|{{{AppendText}}}}}{{#if:{{{SemanticPropertyName|}}}|{{#switch:{{lc:{{{SearchByProperty|false}}}}}|false|f|no|n|0=|true|t|yes|y|1={{#ifexpr:{{#ask:{{{SemanticPropertyName}}}::{{|format=count}}>1| }}}}}}|{{#if:{{{RegexLineCondition|}}}||}}{{#if:{{{SemanticPropertyName|}}}|{{#set:Has improper value for={{{SemanticPropertyName}}}}}|{{#set:Has improper value for=iBox field {{{label|}}}}}}}}}|{{{SameLineDelim|/}}}}}{{#if:{{{RegexValueCondition|}}}|{{#if:{{#regex:{{{RegexValueCondition}}}|%\$$%}}|  {{#regex:{{#var:VarData}}|%({{{RegexValueCondition}}})%}}}}}}{{#vardefine:VarExtra|{{#explode:__VarItem__|~|1}}}}{{#if:{{#var:VarExtra}}|  ({{#var:VarExtra}})}}{{#vardefine:VarMedia|{{#regex:{{#explode:__VarItem__|~}}|%{{#var:Media}}$%}}}}{{#if:{{#var:VarMedia}}|  {{sup|({{#arraymap:{{#var:VarMedia}}|/|_VarMediaItem_|{{Series/Shortname/Link|{{#sub:_VarMediaItem_|1|-1}}}}| / }})}}}}|}}|{{{NewLineDelim|\n\n*}}}}} |condition= }}

This template requires the following extensions:
 * 1) http://www.mediawiki.org/wiki/Extension:Regex_Fun
 * 2) http://www.mediawiki.org/wiki/Extension:Variables
 * 3) http://www.mediawiki.org/wiki/Extension:Semantic_Forms (#arraymap parser)
 * 4) http://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki