Difference between revisions of "Template:Honor infobox"

From Pathfinder Wiki
(fix absent insignia parameter.)
Line 93: Line 93:
 
| colspan="2" |<div class="dropdown"><htmltag tagname="button" class="btn btn-accent dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{Localize|Downloads}}</htmltag><div class="dropdown-menu" aria-labelledby="dropdownMenuButton"><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Requirements{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Requirements}}
 
| colspan="2" |<div class="dropdown"><htmltag tagname="button" class="btn btn-accent dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{Localize|Downloads}}</htmltag><div class="dropdown-menu" aria-labelledby="dropdownMenuButton"><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Requirements{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Requirements}}
 
</htmltag><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Answer Key}}</htmltag></div></div>
 
</htmltag><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Answer Key}}</htmltag></div></div>
|}</div>
+
|}</div>[[Category:UsesLoops]]
 
</includeonly>
 
</includeonly>

Revision as of 00:11, 18 March 2021

This template creates an infobox for an honor.

Mechanics

We had to be careful when invoking See_Also - it uses the honorname parameter to construct the name of a category under which related honors can be found. But the honorname parameter is translated and the categories are not. So even though See_Also wants an honorname, it always wants it in English, and then it tacks a language suffix to the end of the category. To fix this, we needed to extract See_Also's honorname parameter from the invoking page's title using titleparts to grab the second element.

The remaining mechanics are just opaque magic (sorry).

Example

{{Template:Honor infobox
|honorname=Camping Skills IV
|skill=2
|year=2001
|category=Recreation
|authority=General Conference
|insignia=Camping_Skills_IV.png
|insignia_source=foo
|master1=Wilderness
}}


Camping Skills IV
Recreation
[[File:|170px|link=|alt=|]]
Skill Level
123
Approval authority
Year of Introduction

2001


Rock Climbing
Recreation
[[File:|170px|link=|alt=|]]
Skill Level
123
Approval authority
Year of Introduction

1970


Rock Climbing
Recreation
[[File:|150px|alt=|]]
Skill Level
123
Approval authority
Year of Introduction

1970