Difference between revisions of "Template:Format"

From Wikibase Personal data
Jump to navigation Jump to search
(Created page with "<includeonly><code>{{{{#if:{{{subst|}}}|subst:}}{{#ifeq:{{padleft:|1|{{{1}}}}}|:|:[[{{FULLPAGENAME:{{{1}}}}}]]|{{#switch:{{NAMESPACE:{{{1}}}}}|{{ns:0}}|{{ns:10}}...")
 
 
Line 1: Line 1:
<includeonly><code>&#123;&#123;{{#if:{{{subst|}}}|subst:}}{{#ifeq:{{padleft:|1|{{{1}}}}}|:|&#58;[[{{FULLPAGENAME:{{{1}}}}}]]|{{#switch:{{NAMESPACE:{{{1}}}}}|{{ns:0}}|{{ns:10}}=[[{{ns:10}}:{{PAGENAME:{{{1}}}}}|{{PAGENAME:{{{1}}}}}]]|{{ns:6}}|{{ns:14}}=[[:{{{1}}}]]|#default=[[{{{1}}}]]}}}}{{#ifeq:{{{2|x}}}|{{{2}}}|&#124;{{{2}}}}}{{#ifeq:{{{3|x}}}|{{{3}}}|&#124;{{{3}}}}}{{#ifeq:{{{4|x}}}|{{{4}}}|&#124;{{{4}}}}}{{#ifeq:{{{5|x}}}|{{{5}}}|&#124;{{{5}}}}}{{#ifeq:{{{6|x}}}|{{{6}}}|&#124;{{{6}}}}}{{#ifeq:{{{7|x}}}|{{{7}}}|&#124;{{{7}}}}}{{#ifeq:{{{8|x}}}|{{{8}}}|&#124;{{{8}}}}}{{#ifeq:{{{9|x}}}|{{{9}}}|&#124;{{{9}}}}}{{#ifeq:{{{10|x}}}|{{{10}}}|&#124;{{{10}}}}}&#125;&#125;</code></includeonly><noinclude>{{Documentation}}</noinclude>
+
<noinclude>{{doc}}</noinclude><!--
 +
 
 +
 
 +
  &#8239; : non breaking spaces to prevent html tag interpretations and put spaces
 +
 
 +
-->{{#ifeq:{{{1|}}}|item<!--
 +
    #then:
 +
  -->|<span style="background:{{{color|None}}};"><&#8239;<span style="font-family:fixed;">{{{2|}}}</span>&#8239;></span><!--
 +
    #else:
 +
  -->|{{#ifeq:{{{1|}}}|property<!--
 +
        #the
 +
        -->|''{{{2|}}}''<!--
 +
        #else:
 +
      -->|{{#ifeq:{{{1|}}}|value<!--
 +
            #then:
 +
            -->|{{#ifeq:{{{2|}}}|no value<!--
 +
                -->|{{no value}} <!--
 +
                -->|{{#ifeq:{{{2|}}}|some value<!--
 +
                  -->|{{some value}}<!--
 +
                  -->|<span style="background:{{{color|None}}};"><&#8239;<span style="font-family:fixed;">{{{2|}}}</span>&#8239;></span><!--
 +
                -->}}<!--
 +
            -->}}<!--
 +
            #else:
 +
            -->|{{error|first parameter must be either "item", "property" or "value"}}<!--
 +
      -->}}<!--
 +
    -->}}<!--
 +
-->}}

Latest revision as of 19:27, 23 October 2019

Documentation icon Template documentation[view] [edit] [history] [purge]

Template used to format uniformally (resp.) property and item labels. Useful into other templates to display with the same conventions. Used for example in {{C}}

Usage

< Universe >

< Q1 >

  • {{Format|property|instance of}}

instance of

instance of (P3)

  • {{Format|item|Universe|color=Blue}}

< Universe >

  • {{Format|value|no value|color=None}}

no value Help

See also

  • {{C}}

<templatedata> { "params": { "1": { "aliases": [ "type" ], "label": "type of format to use", "description": "\"value\" for a claim value, \"item\" for an item, \"property\" for a property ", "example": "< Q5 >", "type": "string", "required": true, "suggested": true }, "2": { "aliases": [ "value" ], "description": "the value to format", "example": "Q5, no value, P31, instance of, ...", "type": "string", "suggested": true }, "color": {} }, "description": "Used to format properties, items or statement values in a consistent way, used for example in Template:Claim", "format": "inline" } </templatedata>

first parameter must be either "item", "property" or "value"