Template:Template sandbox: Difference between revisions

From Ring of Brodgar
Jump to navigation Jump to search
(Enabled line-delimiter.)
Tag: Reverted
(Reset.)
Tags: Replaced Manual revert
Line 1: Line 1:
<noinclude >'''''{{PAGENAME}}''' page.''
<noinclude>'''''{{PAGENAME}}''' page.''
{{sandbox|:This is the RoB-template-sandbox where you can play and try out template debugging safely.
{{sandbox|:This is the RoB-template-sandbox where you can play and try out template debugging safely.
:Can be used together with the [[sandbox|general sandbox page]].
:Can be used together with the [[sandbox|general sandbox page]].
:Note: No semantic in-text annotations when used as stand-alone self-calling template.}}
:Note: No semantic in-text annotations when used as stand-alone self-calling template.}}
<!--COMMENT Feel free to temporary remove this page-header when testing. Just restore it again after your done.
<!--COMMENT Feel free to temporary remove this page-header when testing. Just restore it again after your done. --></noinclude>
Additional available in-template data: https://www.semantic-mediawiki.org/wiki/Help:Plainlist_format/parameter_template
* querycondition: '{{{#querycondition|<empty>}}}'
* querylimit: '{{{#querylimit|<empty>}}}'
* resultoffset: '{{{#resultoffset|<empty>}}}'
* rowcount: '{{{#rowcount}}}' - is static "format=count" value.
* rownumber: '{{{#rownumber}}}' - starts counting from offset+1!
--></noinclude
 
><!-- code part:begin --><includeonly
 
>{{#if: {{{1|}}}
 
|  {{#switch: {{{1}}}
 
  | specifics = <!-- "specifics" mode -- Return specific-names list for target item.
    -->{{#if: {{{2|}}}
      | {{#ifeq:{{NAMESPACE}}|{{ns:legacy}}
        | {{#show: {{{2}}} | ?legacy-specific | format=plainlist | link = none }}
        | {{List_normalize|{{#replace: {{#replace: {{#show: {{{2}}} | ?specific | format=plainlist | link = none }} | Generics }} | {{{2|}}} }} }}
        }}<!-- if:ns:close
 
      -->{{#if: {{#pos:{{#show:{{{2}}}|?specific|format=plainlist|link=none}}|{{{2}}}}} | {{#set:Test_Text={{{2}}};{{#show:{{{2}}}|?specific|format=plainlist|link=none}}|+sep=*}} }}<!-- additional debug-data dumping.
 
    -->}}<!-- if:2:close (NOP if P2 is not given)
 
-->| #default = <!-- General mode --
  -->{{#ifeq:{{NAMESPACE}}|{{ns:legacy}}
 
    | {{#if: {{{2|}}}<!-- legacy --
    -->| {{#if: {{#ask: [[legacy-requires::{{{1}}}]]}} | {{#ask: [[legacy-requires::{{{1}}}]]}},&#32;}}{{
          #if: {{#explode:{{{2}}}|,|0}} |        <b>(</b><i>{{#explode:{{{2}}}|,|0}}</i><b>:</b>  {{#ask: [[legacy-requires::{{#explode:{{{2}}}|,|0}}]]}}<b>)</b>}}{{
          #if: {{#explode:{{{2}}}|,|1}} |, <b>(</b><i>{{trim|{{#explode:{{{2}}}|,|1}}}}</i><b>:</b> {{#ask: [[legacy-requires::{{#explode:{{{2}}}|,|1}}]]}}<b>)</b>}}{{
          #if: {{#explode:{{{2}}}|,|2}} |, <b>(</b><i>{{trim|{{#explode:{{{2}}}|,|2}}}}</i><b>:</b> {{#ask: [[legacy-requires::{{#explode:{{{2}}}|,|2}}]]}}<b>)</b>}}{{
          #if: {{#explode:{{{2}}}|,|3}} |, <b>(</b><i>{{trim|{{#explode:{{{2}}}|,|3}}}}</i><b>:</b> {{#ask: [[legacy-requires::{{#explode:{{{2}}}|,|3}}]]}}<b>)</b>}}{{
          #if: {{#explode:{{{2}}}|,|4}} |, <b>(</b><i>{{trim|{{#explode:{{{2}}}|,|4}}}}</i><b>:</b> {{#ask: [[legacy-requires::{{#explode:{{{2}}}|,|4}}]]}}<b>)</b>}}
      | {{#if: {{#ask: [[legacy-requires::{{{1}}}]]}} | {{#ask: [[legacy-requires::{{{1}}}]]}} | {{RoB color|result_none|None}} }}
      }}<!-- if:2:close -->
 
    | {{#if: {{{2|}}}<!-- main/hafen --
    -->| {{#if: {{#ask: [[requires::{{{1}}}]]}} | {{RequiredBy2/output|main|{{{1}}}}}{{RequiredBy2/output|line}}}}{{<!-- ask item-specific RB's -- next do same for specific-names -->
          #if: {{#explode:{{{2}}}|,|0}} |  {{RequiredBy2/output|type|{{#explode:{{{2}}}|,|0}}}}}}{{
          #if: {{#explode:{{{2}}}|,|1}} |{{RequiredBy2/output|line}} {{RequiredBy2/output|type|{{#explode:{{{2}}}|,|1}}}}}}{{
          #if: {{#explode:{{{2}}}|,|2}} |{{RequiredBy2/output|line}} {{RequiredBy2/output|type|{{#explode:{{{2}}}|,|2}}}}}}{{
          #if: {{#explode:{{{2}}}|,|3}} |{{RequiredBy2/output|line}} {{RequiredBy2/output|type|{{#explode:{{{2}}}|,|3}}}}}}{{
          #if: {{#explode:{{{2}}}|,|4}} |{{RequiredBy2/output|line}} {{RequiredBy2/output|type|{{#explode:{{{2}}}|,|4}}}}}}
      | {{#if: {{#ask: [[requires::{{{1}}}]]}} | {{RequiredBy2/output|main|{{{1}}}}} | {{RequiredBy2/output|none}} }}<!-- item-specific only case, no specific-names given -->
      }}<!-- if:2:close -->
 
    }}<!-- if:ns:close -->
 
  }}<!-- switch:close
 
-->| {{error|Missing input data.|RequiredBy2: }}<!--
-->}}<!-- if:1:close
 
--></includeonly
 
><noinclude><!--
 
-- usage: {{RequiredBy2 | <item-pagename> | {{RequiredBy2 | specifics | <item-pagename> }}}}
 
--><! -- Preview/Debug. --
 
x1) {{RequiredBy2 | specifics | Stinging_Nettle }} <!-- specific-names list. -->
 
x2) {{RequiredBy2 | Stinging_Nettle }} <!-- page/item specific usages only. -->
 
.... ... ...
 
:Stinging_Nettle full output:
"{{{{PAGENAME}} | Stinging_Nettle | {{{{PAGENAME}} | specifics | Stinging_Nettle}}}}"
 
.... ... ...
 
:-0) <i>(no input)</i> {{{{PAGENAME}}}}
:-1) <i>(...)</i> {{{{PAGENAME}} | foobar }}
:-2) <i>(...)</i> {{{{PAGENAME}} | foobar1 | foobar2 }}
<!--
 
:31) <i>(specifics only)</i> {{{{PAGENAME}} | Chicken_Meat | {{{{PAGENAME}} | specifics | Chicken_Meat}}}}
 
:32) <i>(specifics only)</i> {{{{PAGENAME}} | Billygoat_Horn | {{{{PAGENAME}} | specifics | Billygoat_Horn}}}}
 
:33) <i>(page only)</i> {{{{PAGENAME}} | Wooden_Shovel  | {{{{PAGENAME}} | specifics | Wooden_Shovel}}}}
Fireplace(~200)
 
:34) <i>(neither)</i> {{{{PAGENAME}} | Spitroast_Walrus | {{{{PAGENAME}} | specifics | Spitroast_Walrus}}}}
 
:35) <i>(mixed)</i> {{{{PAGENAME}} | Milk | {{{{PAGENAME}} | specifics | Milk}}}}
 
:Trailing delimiter in specific-output effect. (<i>kinda minor, fix probably not so minor</i>)
:91a) {{RequiredBy2 | Milk | }}
:91b) {{RequiredBy2 | Milk | ,,, }}
:91c) {{RequiredBy2 | Milk | Milk,,, }}
:91d) {{RequiredBy2 | Milk | ,,,Milk }}
 
-->
</noinclude>

Revision as of 18:32, 12 September 2022

Template sandbox page.

This is the RoB-template-sandbox where you can play and try out template debugging safely.
Can be used together with the general sandbox page.
Note: No semantic in-text annotations when used as stand-alone self-calling template.