Difference between revisions of "Template:Reqreq"

From Pathfinder Wiki
m (Protected "Template:Reqreq": High impact template ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(add ability to hide the circle and add ability to define the section name)
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{clear}}
 
<b>{{{num}}}. {{:{{#titleparts:{{{page}}}|3|1}}/Requirement/{{{num}}}{{#switch:{{SUBPAGENAME}}|es=/es|fr=/fr}}}}</b>
 
 
<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.
 +
 +
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:
 +
<nowiki>{{reqreq|page=AY Honors/Amphibians|num=1}}</nowiki><br />
 +
shows requirement 1 of the Amphibians honor, displayed as below:
 +
 +
{{reqreq|page=AY Honors/Amphibians|num=1}}
 +
 +
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 <nowiki><section begin=''identifier''></nowiki> and <nowiki><section end=''identifier''></nowiki>, with the requirement placed between the two tags.
 +
 +
[[Category:Requirements Template]]
 +
</noinclude>{{#if:{{#pos:{{{page|}}}
 +
            |Requirements}}
 +
    |{{#vardefine:reqpage|{{{page}}}}}
 +
    |{{#vardefine:reqpage|{{#titleparts:{{{page}}}|2|1}}/Requirements}}}}{{#if:{{{dispreq|}}}|{{#ifeq:{{{dispreq}}}|false||{{{dispreq}}}}}|{{{num}}}.}} {{#lst:{{#var:reqpage}}{{GetLangSuffix}}
 +
|{{{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}}}.