Difference between revisions of "Template:Metadata/List to property"

From OpenMedia
Jump to: navigation, search
m (fix parsing user)
m (+sep)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
Parse a semicolon list to a property (check for Wiki User syntax). Part of [[{{#titleparts:{{FULLPAGENAME}}|1}}]].
 
Parse a semicolon list to a property (check for Wiki User syntax). Part of [[{{#titleparts:{{FULLPAGENAME}}|1}}]].
 +
 +
== Usage ==
 +
 +
<nowiki>{{</nowiki>{{PAGENAME}}|list=one; two; three;|property=myproperty}}
 +
<nowiki>{{</nowiki>{{PAGENAME}}|list=one; two; three;|property=myproperty|add category=yes}}
 +
<nowiki>{{</nowiki>{{PAGENAME}}|list=one; two; three;|property=myproperty|strip formatting=yes}}
 +
 +
Output would be: one&#160;•&#32;two&#160;•&#32;three.
 +
 +
Some properties will create a search link to http://species-id.net/openmedia/Special:RunQuery/Search_media_by_metadata
  
 
==Parameters==
 
==Parameters==
Line 6: Line 16:
 
<div class="definition-inline">
 
<div class="definition-inline">
 
; |list= : parameter value (semicolon list)
 
; |list= : parameter value (semicolon list)
 +
; |sep= : separator value (default <code>&amp;#160;•&amp;#32;</code>)
 
; |property= : name of the property to save to
 
; |property= : name of the property to save to
 +
; |add category= : (default no) possible values 1, true, yes
 +
; |strip formatting= : (default no) possible values 1, true, yes. Strips formatting of property but not the display
 
</div>
 
</div>
 +
 +
== Dependencies ==
 +
 +
* [[Template:Metadata]]
 +
* [[Template:Search media by metadata]]
 +
* [[Template:StripFormatting]]
 +
* [[Form:Search media by metadata]]
 +
* [[mediawikiwiki:Extension:Semantic Forms|Extension:Semantic Forms]]
 +
 
</noinclude><includeonly>{{#arraymap:  {{{list}}}<!--
 
</noinclude><includeonly>{{#arraymap:  {{{list}}}<!--
 
     -->|;<!--
 
     -->|;<!--
 
     -->|§<!--
 
     -->|§<!--
     -->|§<!-- output --><!--
+
     -->|<!-- output -->{{#switch: {{LC:{{{property}}} }}
 +
|creator={{#queryformlink: form=Search media by metadata|Search media by metadata[creator]={{#switch: {{LC:{{{strip formatting}}} }} |1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|contributor={{#queryformlink: form=Search media by metadata|Search media by metadata[contributor]={{#switch: {{LC:{{{strip formatting}}} }} |1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|scientific name={{#queryformlink: form=Search media by metadata|Search media by metadata[scientific name]={{#switch: {{LC:{{{strip formatting}}} }}|1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|scientific name with author={{#queryformlink: form=Search media by metadata|Search media by metadata[scientific name]={{#switch: {{LC:{{{strip formatting}}} }}|1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|scientific name synonym={{#queryformlink: form=Search media by metadata|Search media by metadata[scientific name]={{#switch: {{LC:{{{strip formatting}}} }} |1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|common name={{#queryformlink: form=Search media by metadata|Search media by metadata[common names]={{#switch: {{LC:{{{strip formatting}}} }} |1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|general keywords={{#queryformlink: form=Search media by metadata|Search media by metadata[keywords]={{#switch: {{LC:{{{strip formatting}}} }}|1|true|yes={{StripFormatting|1=§}}|#default=§}}|wpRunQuery=true|link text=§}}
 +
|#default=§
 +
}}{{#switch: {{LC:{{{add category}}} }}
 +
|1|true|yes=[[category:{{StripFormatting|1=§}}]]
 +
}}<!--  
 
       + hidden property [[{{{property}}}::...| ]]
 
       + hidden property [[{{{property}}}::...| ]]
 
       -->{{#ifeq: {{#sub: §|0|1}} |[<!--
 
       -->{{#ifeq: {{#sub: §|0|1}} |[<!--
Line 37: Line 70:
 
           -->|{{#sub: §|5}}<!--
 
           -->|{{#sub: §|5}}<!--
 
             "user:" → false
 
             "user:" → false
           -->|[[{{{property}}}::§| ]]<!--
+
           -->|[[{{{property}}}::{{#switch: {{LC:{{{strip formatting}}} }}
 +
|1|true|yes={{StripFormatting|1=§}}|#default=§}}| ]]<!--
 
         -->}}<!--
 
         -->}}<!--
 
       -->}}<!-- ifeq::end check wikilink  --><!--
 
       -->}}<!-- ifeq::end check wikilink  --><!--
 
     --><!--
 
     --><!--
     -->|&#32;•&#32;<!-- separate anew
+
     -->|{{{sep|&#160;•&#32;}}}<!-- separate anew
 
   -->}}</includeonly>
 
   -->}}</includeonly>

Latest revision as of 21:31, 28 June 2017

Parse a semicolon list to a property (check for Wiki User syntax). Part of Template:Metadata.

Usage

{{Metadata/List to property|list=one; two; three;|property=myproperty}}
{{Metadata/List to property|list=one; two; three;|property=myproperty|add category=yes}}
{{Metadata/List to property|list=one; two; three;|property=myproperty|strip formatting=yes}}

Output would be: one • two • three.

Some properties will create a search link to http://species-id.net/openmedia/Special:RunQuery/Search_media_by_metadata

Parameters

Mandatory parameters:

|list= 
parameter value (semicolon list)
|sep= 
separator value (default &#160;•&#32;)
|property= 
name of the property to save to
|add category= 
(default no) possible values 1, true, yes
|strip formatting= 
(default no) possible values 1, true, yes. Strips formatting of property but not the display

Dependencies