Difference between revisions of "Template:LogList"

From Masq
m
m
 
(45 intermediate revisions by one user not shown)
Line 1: Line 1:
<includeonly>{{#vardefine: plain_name | {{#sub:{{{the_log}}}|2|-2}} }}
+
<includeonly>{{#dplvar:set|date_type|{{#ifeq:{{uc:{{{date_style}}}}}|RL|RL|IC}}}}
{{ #dpl:  
+
{{#ifeq:{{lc:{{{explain_date}}}}}|yes|<center>''-= Dates are {{#dplvar:date_type}} =-''</center>|}}<table class="sortable" id="presort_adv"><tr style="display:none;"><th data-sort-type="date" {{#ifeq:{{lc:{{{reverse}}}}}|yes|id="reverse"|}}></th><th class="unsortable"></th></tr>
 +
{{#fornumargs: startkey
 +
|startvalue
 +
|{{#dplvar:set|key|{{#explode:{{#var:startvalue}}|~|0}}}}{{#dplvar:set|value|{{#explode:{{#var:startvalue}}|~|1}}}}
 +
{{#switch: {{#dplvar: key}}
 +
| the_log=
 +
{{#dplvar:set|plain_name | {{#sub:{{#dplvar: value}}|2|-2}}}}
 +
{{#dplvar:set|the_title|None.}}
 +
{{#dplvar:set|the_desc|None.}}
 +
| my_title=
 +
{{#dplvar:set|the_title|{{#dplvar:value}}}}
 +
| description=
 +
{{#dplvar:set|the_desc|{{#dplvar:value}}}}
 +
{{#dplvar:set|the_date|
 +
{{#dpl:  
 
| namespace=
 
| namespace=
| titlematch={{#var:plain_name}}
+
| titlematch={{#dplvar:plain_name}}
 
| replaceintitle=/^.*?\s-\s/,
 
| replaceintitle=/^.*?\s-\s/,
 
| category=Log
 
| category=Log
| include={log}:rl_date
+
| include={{#ifeq:{{#dplvar:date_type}}|RL|{log}:rl_date|{log}:ic_date}}
| format= ,,: [[%PAGE%|{{{my_title|%TITLE%}}}]]<br />,<div style="padding-left: 2.75em; margin-top:-.5em; font-style:italic;">\n{{{description}}}\n</div>
+
| format=,,,
| secseparators=&nbsp;
+
| secseparators=
 
| noresultsheader=Nothing to see here.
 
| noresultsheader=Nothing to see here.
}}</includeonly>
+
}}}}
<noinclude>== Usage ==
+
<tr><td style="display:none;">{{#dplvar:the_date}}</td>
 +
<td><span {{#if:{{{dateclass}}}| class="{{{dateclass}}}"}}>{{#dplvar:the_date}}:</span> [[{{#dplvar:plain_name}}|{{#ifeq:{{#dplvar:the_title}}|None.|{{#regex:{{#regex:{{#dplvar:plain_name}}|%^.*\-(.*)$%|$1}}|/_/|&nbsp;}}|{{#dplvar:the_title}}}}]]<br /><div class="logdesc">{{#dplvar:the_desc}}</div></td></tr>
 +
}}
 +
}}
 +
</table>
 +
</includeonly><noinclude>== Usage ==
 
<pre>
 
<pre>
 
{{LogList
 
{{LogList
|the_log=Link to page name
+
|date_style=RL/IC
|my_title=Title you'd prefer to use, if not the default
+
|explain_date=yes/no
|description=Your description of the scene.
+
|reverse=yes/no
 +
|-------------------
 +
|the_log~Link to page name
 +
|my_title~Title you'd prefer to use, if not the default
 +
|description~Your description of the scene.
 
}}
 
}}
 
</pre>
 
</pre>
  
This is a helper template to format AdvLog pages.
+
This is a helper template to format AdvLog pages and sort them automagically.
  
 
=== Examples ===
 
=== Examples ===
 
<pre>
 
<pre>
 
{{LogList
 
{{LogList
|the_log=[[Jai - Fork In The Road]]
+
|date_style=RL
|description=In which Petra presents Jai with a decent proposal, for a change.
+
|explain_date=yes
 +
|reverse=yes
 +
|-------------------
 +
|the_log~[[Jai - Sugar Lumps]]
 +
|description~When you party with the party prince, you get two complimentary after-dinner mints.
 +
|the_log~[[Jai - Fork In The Road]]
 +
|my_title~This Is The Title I Prefer
 +
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
 
}}
 
}}
 
</pre>
 
</pre>
The basic use, giving you:
 
{{LogList
 
|the_log=[[Jai - Fork In The Road]]
 
|description=In which Petra presents Jai with a decent proposal, for a change.
 
}}
 
  
If you're fine with the default title, leave the 'my_title' line out entirely.
+
The optional elements include 'my_title', which should be inserted only for each log whose title you want to change on your page, and three special options above the line, 'date_style', 'explain_date', and 'reverse'.  (For some reason, 'reverse' isn't working on this page.  It's working where it matters, though.)
  
 +
{{LogList
 +
|date_style=RL
 +
|explain_date=yes
 +
|reverse=yes
 +
|-------------------
 +
|the_log~[[Jai - Sugar Lumps]]
 +
|description~When you party with the party prince, you get two complimentary after-dinner mints.
 +
|the_log~[[Jai - Fork In The Road]]
 +
|my_title~This Is The Title I Prefer
 +
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
 +
}}
 
<pre>
 
<pre>
 
{{LogList
 
{{LogList
|the_log=[[Jai - Fork In The Road]]
+
|the_log~[[Jai - Sugar Lumps]]
|my_title=This Is The Title I Prefer
+
|description~When you party with the party prince, you get two complimentary after-dinner mints.
|description=In which Petra presents Jai with a decent proposal, for a change.
+
|the_log~[[Jai - Fork In The Road]]
 +
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
 
}}
 
}}
 
</pre>
 
</pre>
 
+
This is the most basic use, giving you:
Including it is the second option, giving you:
+
 
{{LogList
 
{{LogList
|the_log=[[Jai - Fork In The Road]]
+
|the_log~[[Jai - Sugar Lumps]]
|my_title=This Is The Title I Prefer
+
|description~When you party with the party prince, you get two complimentary after-dinner mints.
|description=In which Petra presents Jai with a decent proposal, for a change.
+
|the_log~[[Jai - Fork In The Road]]
 +
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
 
}}
 
}}
 +
=== More Explanation ===
 +
This template is slightly trickier to use than most. 
 +
* You only need one instance of this template in your AdvLog page. 
 +
* Each log in your list takes a "the_log", an optional "my_title", and a "description". 
 +
**They need to be in order (the_log, my_title if used, description) and please note that the repeated parameters are set off by a ~, '''not''' a =.  If you don't do it this way, it won't work! 
 +
** Using a ~ or an = in any of your log names/titles/description will also not work as expected.
 +
* The optional parameters above the dashed line '''DO''' use an equals sign, however. 
 +
** If you leave out these parameters, the default behaviour is to use IC dates, not give the date explanation line, and display your logs from oldest to newest.
 +
** These parameters are independent of each other; you can freely use IC dates and explain it, use RL and not explain it, reverse the order and explain the date, or whatever combination you like.
  
You'll need to paste a separate instance of this template into your AdvLog page for each log you want in your formatted list.
+
If you find yourself confused, check (but don't change) [[Jai/AdvLog]], where you can see this in use.
 
[[Category: Templates]]</noinclude>
 
[[Category: Templates]]</noinclude>

Latest revision as of 08:17, 9 March 2013

Usage

{{LogList
|date_style=RL/IC
|explain_date=yes/no
|reverse=yes/no
|-------------------
|the_log~Link to page name
|my_title~Title you'd prefer to use, if not the default
|description~Your description of the scene.
}}

This is a helper template to format AdvLog pages and sort them automagically.

[edit] Examples

{{LogList
|date_style=RL
|explain_date=yes
|reverse=yes
|-------------------
|the_log~[[Jai - Sugar Lumps]]
|description~When you party with the party prince, you get two complimentary after-dinner mints.
|the_log~[[Jai - Fork In The Road]]
|my_title~This Is The Title I Prefer
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
}}

The optional elements include 'my_title', which should be inserted only for each log whose title you want to change on your page, and three special options above the line, 'date_style', 'explain_date', and 'reverse'. (For some reason, 'reverse' isn't working on this page. It's working where it matters, though.)


-= Dates are RL =-
10/21/2010 10/21/2010: Sugar Lumps
When you party with the party prince, you get two complimentary after-dinner mints.
11/23/2011 11/23/2011: This Is The Title I Prefer
In which Petra presents Jai with a decent proposal, for a change.
{{LogList
|the_log~[[Jai - Sugar Lumps]]
|description~When you party with the party prince, you get two complimentary after-dinner mints.
|the_log~[[Jai - Fork In The Road]]
|description~In which Petra presents Jai with a '''decent''' proposal, for a change.
}}

This is the most basic use, giving you:

01/23/2008 01/23/2008: Sugar Lumps
When you party with the party prince, you get two complimentary after-dinner mints.
09/12/2009 09/12/2009: Fork In The Road
In which Petra presents Jai with a decent proposal, for a change.

[edit] More Explanation

This template is slightly trickier to use than most.

  • You only need one instance of this template in your AdvLog page.
  • Each log in your list takes a "the_log", an optional "my_title", and a "description".
    • They need to be in order (the_log, my_title if used, description) and please note that the repeated parameters are set off by a ~, not a =. If you don't do it this way, it won't work!
    • Using a ~ or an = in any of your log names/titles/description will also not work as expected.
  • The optional parameters above the dashed line DO use an equals sign, however.
    • If you leave out these parameters, the default behaviour is to use IC dates, not give the date explanation line, and display your logs from oldest to newest.
    • These parameters are independent of each other; you can freely use IC dates and explain it, use RL and not explain it, reverse the order and explain the date, or whatever combination you like.

If you find yourself confused, check (but don't change) Jai/AdvLog, where you can see this in use.