From GamingWiki
Jump to: navigation, search
 
(27 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
{{Campaign timeline intro}}
 
{{Campaign timeline intro}}
 
<onlyinclude><!--
 
<onlyinclude><!--
 +
 +
-->{{info/campaign|{{#var:campaign}}}}<!--
 +
-->{{#vardefine:campaignInfo|campaignInfo_{{#var:campaign}}}}<!--
 +
 +
-->{{#hashdefine: userParams | {{{userparam|}}} }}<!--
 +
 +
-->{{#vardefine: expandbook  | {{#hashvalue: userParams | expandbook}} }}<!--
 +
 +
  We can optionally specify different labels. Here is a somewhat complicated set of defaults:
 +
-->{{#vardefine: booklabel    | {{#hashvalue: {{#var:campaignInfo}}|Uses book label}}}}<!--
 +
 
-->{{Campaign timeline bookline  
 
-->{{Campaign timeline bookline  
       | label  = Chapter
+
       | label  = {{#var:booklabel}}
 
       | ordinal = {{{3}}}
 
       | ordinal = {{{3}}}
 
       | title  = {{{2}}}
 
       | title  = {{{2}}}
Line 14: Line 25:
 
       }}<!--
 
       }}<!--
  
-->[[SMW::on]]{{#ask: [[Category: {{#var:campaign}}]] [[is a::chapter]] [[parent::{{{1|Null}}}]]
+
-->{{#if: <!--
|?title
+
    If the current "expandbook" is set to the current book number
|?ordinal
+
  -->{{#ifeq: {{#var:expandbook|latest}}| {{{3|M_NUL}}} | 1 }}<!--
|?blurb
+
    or we are told to expand all books
| sort          = ordinal
+
  -->{{#ifeq:{{#var:expandbook}}| all | 1 }}<!--
| link          = none
+
 
| format        = template
+
-->|<!-- then expand the current book
| template      = SMW campaign chapter
+
 
}}[[SMW::off]]<!--
+
    Run a subquery on the book's chapters
 +
  -->{{#vardefineecho:innerqueryresult|{{#ask: [[chapter of campaign::{{#var:campaign}}]][[book number::{{{3|M_NUL}}}]]
 +
      |?title
 +
      |?ordinal
 +
      |?blurb
 +
      |?label
 +
      | sort          = ordinal,title
 +
      | link          = none
 +
      | format        = template
 +
      | template      = SMW campaign chapter
 +
      | userparam    = {{{userparam|}}}
 +
      }}}}<!--
 +
 
 +
-->|<!-- else don't expand the current book
 +
 
 +
  -->{{#vardefine:latestbook|{{{3|}}}}}<!-- this gets used higher up
 +
 
 +
-->}}<!-- end #if
 +
 
 
--></onlyinclude>
 
--></onlyinclude>
 
{{Campaign timeline outro}}
 
{{Campaign timeline outro}}

Latest revision as of 16:31, 5 October 2014

Positional parameters for this template are:

  1. page
  2. title
  3. ordinal
  4. blurb

Campaign Timeline
{{{3}}}: [[{{{1}}}|{{{2}}}]]