Difference between revisions of "Template:Reqreq"

From Pathfinder Wiki
(Add ability to specify a reqpage)
(add ability to hide the circle and add ability to define the section name)
 
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
This template extracts requirement '''num''' from page '''page''' and displays it in a way that is useful when you just want the requirement without any formatting.
 
This template extracts requirement '''num''' from page '''page''' and displays it in a way that is useful when you just want the requirement without any formatting.
 +
 +
If you want to extract a specific section you can also use '''reqSection'''. In that case the template will extract exactly that section and will ignore the '''num''' argument. It is needed to get section's that aren't a requirement because using the '''num''' argument the section name get's created by the template.
 +
 +
The '''dispreq''' argument can be used to overwrite the default enumeration in front of the transcluded content. If '''dispreq=false''' nothing get's shown. If '''dispreq''' is set to something other than '''false''', it's content will be shown.
  
 
Example:
 
Example:
Line 14: Line 18:
 
             |Requirements}}
 
             |Requirements}}
 
     |{{#vardefine:reqpage|{{{page}}}}}
 
     |{{#vardefine:reqpage|{{{page}}}}}
     |{{#vardefine:reqpage|{{#titleparts:{{{page}}}|2|1}}/Requirements}}}}{{#if:{{{dispreq|}}}|{{{dispreq}}}|{{{num}}}.}} {{#lst:{{#var:reqpage}}{{GetLangSuffix}}
+
     |{{#vardefine:reqpage|{{#titleparts:{{{page}}}|2|1}}/Requirements}}}}{{#if:{{{dispreq|}}}|{{#ifeq:{{{dispreq}}}|false||{{{dispreq}}}}}|{{{num}}}.}} {{#lst:{{#var:reqpage}}{{GetLangSuffix}}
|req{{{num}}}
+
|{{{reqSection|req{{{num}}}}}}
 
}}
 
}}

Latest revision as of 20:36, 28 September 2021

This template extracts requirement num from page page and displays it in a way that is useful when you just want the requirement without any formatting.

If you want to extract a specific section you can also use reqSection. In that case the template will extract exactly that section and will ignore the num argument. It is needed to get section's that aren't a requirement because using the num argument the section name get's created by the template.

The dispreq argument can be used to overwrite the default enumeration in front of the transcluded content. If dispreq=false nothing get's shown. If dispreq is set to something other than false, it's content will be shown.

Example: {{reqreq|page=AY Honors/Amphibians|num=1}}
shows requirement 1 of the Amphibians honor, displayed as below:

1. What are the characteristics of amphibians?


This uses the #lst: parser directive which takes two arguments: a page, and a section identifier. The page it references must have section tags with <section begin=''identifier''> and <section end=''identifier''>, with the requirement placed between the two tags. {{{num}}}.