Difference between revisions of "Template:Reqreq"

From Pathfinder Wiki
(add ability to hide the circle and add ability to define the section name)
 
(19 intermediate revisions by 3 users not shown)
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:
<nowiki>{{reqreq|page=Adventist Youth Honors Answer Book/Nature/Amphibians|num=11a}}</nowiki><br />  
+
<nowiki>{{reqreq|page=AY Honors/Amphibians|num=1}}</nowiki><br />  
shows requirement 11a of the Amphibians honor, displayed as below:
+
shows requirement 1 of the Amphibians honor, displayed as below:
 +
 
 +
{{reqreq|page=AY Honors/Amphibians|num=1}}
  
{{reqreq|page=Adventist Youth Honors Answer Book/Nature/Amphibians|num=11a}}
+
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.
  
</noinclude>
+
[[Category:Requirements Template]]
{{clear}}
+
</noinclude>{{#if:{{#pos:{{{page|}}}
{{#if:{{{dispreq|}}}|{{{dispreq}}}|{{{num}}}.}} {{#lst:{{#titleparts:{{{page}}}|3|1}}/Requirements/{{#switch:{{SUBPAGENAME}}|es=/es|fr=/fr}}|req{{{num}}}}}
+
            |Requirements}}
<noinclude>[[Category:Requirements Template]]</noinclude>
+
    |{{#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}}}.