Template:Dump: Difference between revisions

From Zelda Dungeon Wiki
Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
(re-added backslashed multiquote support, clarified the code)
(optimized loops, made code ugly. note to self: use sub-templates to reduce code duplication.)
Line 1: Line 1:
<onlyinclude>{{#vardefine:usedelim|}}<!--
<onlyinclude>{{#vardefine:usedelim|}}{{#if: {{#explode:{{{2|}}}|\|1}}
 
| {{#vardefine:ctr|-1}}{{#while: | {{#vardefineecho:slashquote|{{#explode:{{{2|}}}|\|{{++|ctr}}}}}}
For each argument (arg|arg|arg|...)
  | {{#if: {{#explode:{{#var:slashquote}}|-|1}}
-->{{#fornumargs: argnum | argval
    | {{#vardefine:first|{{#explode:{{#var:slashquote}}|-|0}}}}{{#vardefine:last|{{#explode:{{#var:slashquote}}|-|1}}}}<!--
| {{#ifeq: {{#var:argnum}} | 1
  | <!-- game selector - do nothing -->
  | {{#vardefine:ctr|-1}}<!--
 
For each range (range\range\range\...)
-->{{#while: | {{#explode:{{#var:argval}}|\|{{++|ctr}}}}
    | {{#vardefine:range|{{#explode:{{#var:argval}}|\|{{#var:ctr}}}}}}<!--
  -->{{#vardefine:first|{{#explode:{{#var:range}}|-|0}}}}<!--
  -->{{#vardefine:last|{{#explode:{{#var:range}}|-|1}}}}<!--
 
For each quote (qid-qid)
   -->{{#loop: qid | {{#var:first}} | {{#expr:{{!!=|last|{{#var:first}}}}-{{#var:first}}+1}}
   -->{{#loop: qid | {{#var:first}} | {{#expr:{{!!=|last|{{#var:first}}}}-{{#var:first}}+1}}
       | {{#if: {{#var:usedelim}}
       | {{#if: {{#var:usedelim}}
         | {{!!=|dump-qdelim|{{{qdelim|{{S}}}}}}}
         | {{!!=|dump-qdelim|{{{qdelim|{{S}}}}}}}
         | {{#vardefine:usedelim|true}}
         | {{#vardefine:usedelim|true}}
         }}<!--
         }}{{:{{Zelda|{{{1}}}}} Text Dump/Select|{{#var:qid}}|{{!!=|dump-ldelim|{{{ldelim|{{S}}}}}}}}}
    -->{{:{{Zelda|{{{1}}}}} Text Dump/Select|{{#var:qid}}|{{!!=|dump-ldelim|{{{ldelim|{{S}}}}}}}}}
       }}
       }}
    | {{#if: {{#var:usedelim}}
      | {{!!=|dump-qdelim|{{{qdelim|{{S}}}}}}}
      | {{#vardefine:usedelim|true}}
      }}{{:{{Zelda|{{{1}}}}} Text Dump/Select|{{#var:slashquote}}|{{!!=|dump-ldelim|{{{ldelim|{{S}}}}}}}}}
     }}
     }}
  }}
| {{#if: {{#explode:{{{2|}}}|-|1}}
  | {{#vardefine:first|{{#explode:{{{2|}}}|-|0}}}}{{#vardefine:last|{{#explode:{{{2|}}}|-|1}}}}<!--
-->{{#loop: qid | {{#var:first}} | {{#expr:{{!!=|last|{{#var:first}}}}-{{#var:first}}+1}}
    | {{#if: {{#var:usedelim}}
      | {{!!=|dump-qdelim|{{{qdelim|{{S}}}}}}}
      | {{#vardefine:usedelim|true}}
      }}{{:{{Zelda|{{{1}}}}} Text Dump/Select|{{#var:qid}}|{{!!=|dump-ldelim|{{{ldelim|{{S}}}}}}}}}
    }}
  | {{#if: {{#var:usedelim}}
    | {{!!=|dump-qdelim|{{{qdelim|{{S}}}}}}}
    | {{#vardefine:usedelim|true}}
    }}{{:{{Zelda|{{{1}}}}} Text Dump/Select|{{{2|}}}|{{!!=|dump-ldelim|{{{ldelim|{{S}}}}}}}}}
   }}
   }}
}}</onlyinclude>
}}</onlyinclude>

Revision as of 00:58, March 4, 2013

{{:{{{1}}} Text Dump/Select|| }}

Purpose

Use this template to retrieve a specific quote from a text dump. These are frequently used for references by the Cite template and in captions by various [[Caption Templates]].

Usage

{{Dump| dump | quote }}

  • dump — A game abbreviation serving as a keyword to select from which dump to pull the quote.
  • quote — The quote's ID which can be found on the dump page.
  • ldelim — If "ldelim=<br>" is provided, newlines will be preserved as they appear in the game. Otherwise the text will appear on one line. (Optional. Default: [space])
  • qdelim — For multiple quotes, a delimiter can be passed to this named parameter. (Optional. Default: [space])

To find the quote ID, find the desired quote in the text dump (see [[Text Dumps]]) and hover over the tooltip (?) at the beginning of the quote.

Several quotes can be retrieved at once by passing in multiple arguments and/or supplying ranges. For example, {{Dump| SS | 6552-6554 | 6556 }}