Difference between revisions of "Template talk:T chart"

From Pathfinder Wiki
Line 1: Line 1:
 
==Documentation==
 
==Documentation==
 
This template makes a T-chart with up to 6 rows (besides the header).  The first row is mandatory, as is the left column of each row that's present.
 
This template makes a T-chart with up to 6 rows (besides the header).  The first row is mandatory, as is the left column of each row that's present.
{|
+
 
|-
+
===Parameters===
|<nowiki>{{T chart</nowiki><br/>
+
*left_heading - this is the heading over the left column
<nowiki>|left_heading=Fruit</nowiki><br/>
+
*right_heading heading over the right column
<nowiki>|right_heading=Vegetables</nowiki><br/>
+
*L1 - data for the left column, row 1
<nowiki>|L1=Banana</nowiki><br/>
+
*R1 - data for the right column, row 1
<nowiki>|R1=Squash</nowiki><br/>
+
To generalize...
<nowiki>|L2=Apple</nowiki><br/>
+
*L''n'' - data for the left column, row ''n''
<nowiki>|R2=Radish</nowiki><br/>
+
*R''n'' - data for the right column, row ''n''
<nowiki>|L3=Orange</nowiki><br/>
+
 
<nowiki>|R3=Carrot</nowiki><br/>
+
===Example===
<nowiki>|L4=Grape</nowiki><br/>
+
{{T chart
<nowiki>|R4=Eggplant</nowiki><br/>
 
<nowiki>|L5=Lime</nowiki><br/>
 
<nowiki>|R5=Zucchini</nowiki><br/>
 
<nowiki>|L6=Blackberry</nowiki><br/>
 
<nowiki>|R6=Olive</nowiki><br/>
 
<nowiki>}}</nowiki><br/>
 
|{{T chart
 
 
|left_heading=Fruit
 
|left_heading=Fruit
 
|right_heading=Vegetables
 
|right_heading=Vegetables
Line 35: Line 28:
 
|R6=Olive
 
|R6=Olive
 
}}
 
}}
|}
 
  
 
Some of the coding for the template gets funky because you can't mix parser functions like <nowiki>{{#if:}}</nowiki> with vertical bars needed to separate table elements.  So anywhere we have <nowiki>{{!}}</nowiki> is a place where we cannot have a vertical bar (but need one).
 
Some of the coding for the template gets funky because you can't mix parser functions like <nowiki>{{#if:}}</nowiki> with vertical bars needed to separate table elements.  So anywhere we have <nowiki>{{!}}</nowiki> is a place where we cannot have a vertical bar (but need one).
  
==Bugs==
+
===Bugs===
 
The right column ends up with an extra blank line for every unused row.  If I don't put a carriage return between between the <nowiki>{{#if:}}</nowiki> functions, that goes away, but the the {{!}}- row separators break.  I've not figured a way around that yet.
 
The right column ends up with an extra blank line for every unused row.  If I don't put a carriage return between between the <nowiki>{{#if:}}</nowiki> functions, that goes away, but the the {{!}}- row separators break.  I've not figured a way around that yet.
  

Revision as of 01:51, 9 May 2020

Documentation

This template makes a T-chart with up to 6 rows (besides the header). The first row is mandatory, as is the left column of each row that's present.

Parameters

  • left_heading - this is the heading over the left column
  • right_heading heading over the right column
  • L1 - data for the left column, row 1
  • R1 - data for the right column, row 1

To generalize...

  • Ln - data for the left column, row n
  • Rn - data for the right column, row n

Example

Fruit Vegetables
Banana Squash
Apple Radish
Orange Carrot
Grape Eggplant
Lime Zucchini
Blackberry Olive

Some of the coding for the template gets funky because you can't mix parser functions like {{#if:}} with vertical bars needed to separate table elements. So anywhere we have {{!}} is a place where we cannot have a vertical bar (but need one).

Bugs

The right column ends up with an extra blank line for every unused row. If I don't put a carriage return between between the {{#if:}} functions, that goes away, but the the |- row separators break. I've not figured a way around that yet.

Future changes

Might be able to make a row show up if either Ln or Rn are present by doing something like this:

{{#ifexpr: {{#len:{{{L2}}}}}|{{#len:{{{R2}}}}}|code for including the row|}}