Difference between revisions of "Template:Honor index"

From Pathfinder Wiki
(Add excat6)
 
(27 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
<!-- assemble the tablerow argument of DPL so it is customizeable -->
 
<!-- assemble the tablerow argument of DPL so it is customizeable -->
 
<!-- initialize the variables -->
 
<!-- initialize the variables -->
{{#vardefine: selectedcolumns | }}{{#vardefine: selectedcolumns | {{#if: {{{columnselection|}}} | {{{columnselection}}} | :honorname:insignia:category:authority:skill:year }} }}{{#vardefine: tablerow | }}{{#vardefine: tableheader | }}
+
{{#vardefine:selectedcolumns|{{{columnselection|:honorname:insignia:category:authority:skill:year}}}}}
{{#vardefine: i | 1 }}{{#while: <!-- we need to start at word 1 because of the leading : -->
+
{{#vardefine:tablerow|}}{{#vardefine:tableheader|}}{{#vardefine:i|1}}{{#while: <!-- we need to start at word 1 because of the leading : -->|{{#if:{{#explode:{{#var:selectedcolumns}}|:|{{#var:i}}}}|true}}|{{#vardefine:tablerow|{{#var: tablerow}}{{#switch:{{#explode:{{#var: selectedcolumns }}|:|{{#var:i}}}}|honorname=data-sort-value=²{GetHonorName¦page=%PAGE%}²¦[[%PAGE%¦²{GetHonorName¦page=%PAGE%]],|insignia=²{GetInsigniaThumb¦insignia=%%¦usePilotNoPatch={{{usePilotNoPatch¦}}}}²,|category=align="left"¦²{Localize¦%%}²,|authority=align="center"¦²{division honor¦²{division abbrev¦%%}²}²,|skill=align="center"¦²{YearOrUnknown¦%%,|year=align="center"¦²{YearOrUnknown¦%%,}}}}
| {{#if: {{#explode:{{#var: selectedcolumns }}|:|{{#var: i }}}} | true }}
+
{{#vardefine: tableheader|{{#var:tableheader}}{{#switch:{{#explode:{{#var:selectedcolumns}}|:|{{#var:i}}}}|honorname=,{{Localize|Honor}}|insignia=,{{Localize|Patch}}|category=,{{Localize|Category}}|authority=,{{Localize|Approval}}|skill=,{{Localize|Skill Level}}|year=,{{Localize|Year}}}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}}}<nowiki />
| {{#vardefine: tablerow | {{#var: tablerow}}{{#switch: {{#explode:{{#var: selectedcolumns }}|:|{{#var: i }}}} | honorname = [[%PAGE%¦%%]], | insignia = ²{GetInsigniaThumb¦insignia=%%}², | category = align="left"¦²{Localize¦%%}², | authority = align="center"¦²{division honor¦²{division abbrev¦%%}²}², | skill = align="center"¦%%, | year = align="center"¦%%, }} }}
 
{{#vardefine: tableheader | {{#var: tableheader}}{{#switch: {{#explode:{{#var: selectedcolumns }}|:|{{#var: i }}}} | honorname = ,{{Localize|Honor}} | insignia = ,{{Localize|Patch}} | category = ,{{Localize|Category}} | authority = ,{{Localize|Approval}} | skill = ,{{Localize|Skill Level}} | year = ,{{Localize|Year}} }} }}{{#vardefine: i | {{#expr: {{#var: i }} + 1 }} }} }}<nowiki />
 
 
<!-- that loops through all arguments with the prefix cat and saves it into a variable -->
 
<!-- that loops through all arguments with the prefix cat and saves it into a variable -->
{{#vardefine:argIncCat|AY Honors/Honor landing{{GetLangSuffix}}&AY Honors/Primary}}{{#forargs: cat | key | category |<nowiki />{{#vardefine: argIncCat |{{#var:argIncCat}}{{#if:{{#var:category}}|&{{#var:category}}{{GetLangSuffix}} }} }} }}
+
{{#vardefine:argIncCat|AY Honors/HonorLanding{{GetLangSuffix}}&AY Honors/Primary}}{{#forargs: cat | key | category |<nowiki />{{#vardefine:argIncCat|{{#var:argIncCat}}{{#if:{{#var:category}}|&{{#var:category}}{{GetLangSuffix}} }} }} }}
 
{{#dpl:
 
{{#dpl:
|debug=0
+
|debug={{{debug|0}}}
|include={honor_landing}{{#var: selectedcolumns }}
+
|include={HonorLanding}{{#var:selectedcolumns}}
|table=class="wikitable sortable",-{{#var: tableheader }}
+
|table=class="wikitable sortable",-{{#var:tableheader}}
|tablerow={{#var: tablerow}}
+
|tablerow={{#var:tablerow}}
 
|category={{#var:argIncCat}}
 
|category={{#var:argIncCat}}
|notcategory=Uses HonorLanding Template
 
|notcategory=Uses HonorSubpage Template
 
 
|notcategory={{#if:{{{excat1|}}}|{{{excat1}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat1|}}}|{{{excat1}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat2|}}}|{{{excat2}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat2|}}}|{{{excat2}}}{{GetLangSuffix}}}}
Line 22: Line 18:
 
|notcategory={{#if:{{{excat4|}}}|{{{excat4}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat4|}}}|{{{excat4}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat5|}}}|{{{excat5}}}{{GetLangSuffix}}}}
 
|notcategory={{#if:{{{excat5|}}}|{{{excat5}}}{{GetLangSuffix}}}}
 +
|notcategory={{#if:{{{excat6|}}}|{{{excat6}}}{{GetLangSuffix}}}}
 +
|notcategory={{#if:{{{showPiloting|}}}||AY Honors/Piloting{{GetLangSuffix}}}}
 
|nottitleregexp=.*/en$
 
|nottitleregexp=.*/en$
 
|ordermethod=sortkey
 
|ordermethod=sortkey
Line 34: Line 32:
 
*selectedcolumns = {{#var:selectedcolumns}}
 
*selectedcolumns = {{#var:selectedcolumns}}
 
}}
 
}}
[[Category:UsesLoops]]
 
 
</includeonly>
 
</includeonly>
 
<noinclude><nowiki />{{Honor index
 
<noinclude><nowiki />{{Honor index
Line 53: Line 50:
 
"columnselection": {
 
"columnselection": {
 
"label": "Shown columns (and order)",
 
"label": "Shown columns (and order)",
"description": "This defines the shown columns and the order of those. Each column needs to be seperated by a \":\" and it needs to be started with a \":\". Possible columns are: honorname, insignia, category, authority, skill, year",
+
"description": "This defines the shown columns and the order of those. Each column needs to be separated by a \":\" and it needs to be started with a \":\". Possible columns are: honorname, insignia, category, authority, skill, year",
 
"example": ":honorname:insignia:category:authority:skill:year",
 
"example": ":honorname:insignia:category:authority:skill:year",
 
"default": ":honorname:insignia:category:authority:skill:year",
 
"default": ":honorname:insignia:category:authority:skill:year",
Line 81: Line 78:
 
"excat5": {
 
"excat5": {
 
"label": "Fifth excluded Category",
 
"label": "Fifth excluded Category",
 +
"description": "The honor isn't allowed to be in that category.",
 +
"example": "AY Honors/Approved by General Conference"
 +
},
 +
"excat6": {
 +
"label": "Sixth excluded Category",
 
"description": "The honor isn't allowed to be in that category.",
 
"description": "The honor isn't allowed to be in that category.",
 
"example": "AY Honors/Approved by General Conference"
 
"example": "AY Honors/Approved by General Conference"
Line 98: Line 100:
 
"excat4",
 
"excat4",
 
"excat5",
 
"excat5",
 +
"excat6",
 
"catn"
 
"catn"
 
]
 
]
 
}
 
}
</templatedata></noinclude>
+
</templatedata>[[Category:UsesLoops]]</noinclude>

Latest revision as of 01:52, 14 October 2023

Honor Patch Approval Skill Level Year
Fabric Yo-Yo
Fuxico AY Honor.png
SAD tiny.png 1 2012
Music - Beginners
Music Honor AY Honor.png
SPD tiny.png 1 Unknown
Papercraft
Papercraft AY Honor.png
SAD tiny.png 1 2012


Honor Patch Category Approval Skill Level Year
Fabric Yo-Yo
Fuxico AY Honor.png
Arts, Crafts and Hobbies SAD tiny.png 1 2012
Music - Beginners
Music Honor AY Honor.png
Arts, Crafts and Hobbies SPD tiny.png 1 Unknown
Papercraft
Papercraft AY Honor.png
Arts, Crafts and Hobbies SAD tiny.png 1 2012


This template creates a table view, containing the honors in this wiki. The columns shown can be modified also it can be defined which categories should be included and which excluded.

It is very complex so I try to explain what is going on. First in the template we create the needed variables for defining the table (text's of the header, wanted columns, row template). After we did that magic, we have the magic that enables the template to have a dynamic count of needed (included) categories.

That is the whole preparation. Now we only let DPL do it's magic and a nice table will be created... hopefully ;)

模板参数

参数描述类型状态
Shown columns (and order)columnselection

This defines the shown columns and the order of those. Each column needs to be separated by a ":" and it needs to be started with a ":". Possible columns are: honorname, insignia, category, authority, skill, year

默认值
:honorname:insignia:category:authority:skill:year
示例
:honorname:insignia:category:authority:skill:year
自动值
:honorname:insignia:category:authority:skill:year
未知可选
First excluded Categoryexcat1

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
自动值
未知可选
Second excluded Categoryexcat2

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
未知可选
Third excluded Categoryexcat3

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
未知可选
Fourth excluded Categoryexcat4

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
未知可选
Fifth excluded Categoryexcat5

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
未知可选
Sixth excluded Categoryexcat6

The honor isn't allowed to be in that category.

示例
AY Honors/Approved by General Conference
未知可选
Included Categorycatn

This category needs to be included. The n needs to be replaced with an upcounting number, that way it is possible to add multiple categories. An honor included in the list needs to have every added category. For example add those arguments: cat1=mycategory1|cat2=mycategory2 and so on.

示例
AY Honors/Skill Level 1
未知可选