Template:Auto List to Icons: Difference between revisions
Jump to navigation
Jump to search
(not working yet.) |
m (revert) Tag: Manual revert |
||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude>Semantic | <noinclude>This template converts keywords into icons, if found. | ||
{{#ask:[[Category:Infobox Icons]]|mainlabel= | |||
|?Semantic Keyword | Read below the legend for typical template instructions. | ||
Icon Legend | |||
{{List to Icons Table|#userparam=intro}} | |||
{{List to Icons Table|#userparam=header|header=<div id="activities">Nature Activities (hiking, biking, etc.) (Infobox Icon Type: Activities)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Activities]] | |||
|mainlabel=image | |||
|?Has Caption=description | |||
|?Semantic Keyword=keyword | |||
|format=plainlist | |||
|headers=hide | |||
|link=none | |||
|template=List to Icons Table | |||
|userparam=row | |||
|named args=yes | |||
}} | |||
{{List to Icons Table|#userparam=header|header=<div id="features">Features within the park or along the trail (Infobox Icon Type: Features)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Features]] | |||
|mainlabel=image | |||
|?Has Caption=description | |||
|?Semantic Keyword=keyword | |||
|format=plainlist | |||
|headers=hide | |||
|link=none | |||
|template=List to Icons Table | |||
|userparam=row | |||
|named args=yes | |||
}} | |||
{{List to Icons Table|#userparam=header|header=<div id="amenities">Park Amenities (Infobox Icon Type: Park Amenities)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Park Amenities]] | |||
|mainlabel=image | |||
|?Has Caption=description | |||
|?Semantic Keyword=keyword | |||
|format=plainlist | |||
|headers=hide | |headers=hide | ||
|link=none | |||
|template=List to Icons Table | |||
|userparam=row | |||
|named args=yes | |||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=<div id="lodging">Lodging options within the park (Infobox Icon Type: Lodging)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]] | |||
{{#ask:[[Category:Infobox Icons]][[ | |mainlabel=image | ||
|? | |?Has Caption=description | ||
|?Semantic Keyword=keyword | |||
|format=plainlist | |||
|headers=hide | |headers=hide | ||
|link=none | |link=none | ||
|template=List to Icons Table | |||
|userparam=row | |||
|named args=yes | |||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=<div id="campground">Campground amenities (Infobox Icon Type: Campground Amenities)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]] | |||
{{List to Icons Table|userparam= | |mainlabel=image | ||
{{#ask:[[Category:Infobox Icons]] | |?Has Caption=description | ||
|?Has Caption | |?Semantic Keyword=keyword | ||
|?Semantic Keyword | |format=plainlist | ||
|format= | |headers=hide | ||
|link=none | |link=none | ||
|template=List to Icons Table | |template=List to Icons Table | ||
|userparam=row | |userparam=row | ||
|named args=yes | |||
}} | }} | ||
{{List to Icons Table|userparam=outro}} | {{List to Icons Table|#userparam=outro}} | ||
[[Category: | Simply pass the template the comma separated list of terms and it will convert any found keywords to icons, and list the remainder. Although the icons have different groupings, the template doesn't care and is simply looking for keywords with an associated icon. | ||
</noinclude><includeonly> | |||
{{# | Expected usage: | ||
<pre> | |||
{{Template:Auto List to Icons|List=<insert comma separated list>}} | |||
</pre> | |||
How this works: | |||
* Create an array called 'iconslist' of the keywords found in a query of all pages under the category [[:Category:Infobox Icons]] | |||
* Make an array called 'list' from the passed parameter names list | |||
* Make an array called 'noiconsitems' which is the arraydiff of the first two created arrays (items on the passed list that don't have an icon) | |||
* Make a fourth array 'iconitems' which is the intersection of the first two arrays (items on the passed list that '''do''' have an icon) | |||
* For each iconitems, find the keyword matching image and show it | |||
* Then finally, list the noiconsitems last | |||
Edit the page to see the details. | |||
[[Category:Universal Templates]] | |||
</noinclude><includeonly>{{#ask:[[Category:Infobox Icons]] | |||
|mainlabel=- | |||
|?Semantic Keyword | |||
|headers=hide | |||
|link=none | |||
|format=array | |||
|name=iconslist | |||
}}<!-- | |||
-->{{#arraydefine:list|{{{List}}}}}<!-- | |||
-->{{#arraydiff:noiconitems|list|iconslist}}<!-- | |||
-->{{#arrayintersect:iconitems|list|iconslist}} | |||
{{#arraymap:{{#arrayprint:iconitems}} | |||
|, | |, | ||
|@@@@ | |@@@@ | ||
Line 33: | Line 103: | ||
|headers=hide | |headers=hide | ||
|link=none | |link=none | ||
|limit=1 | |||
}}|25px|@@@@]] | }}|25px|@@@@]] | ||
| | | | ||
}} | }}<!-- | ||
--><br>{{#arrayprint:noiconitems}} | |||
</includeonly> | </includeonly> |
Latest revision as of 14:44, 24 June 2023
This template converts keywords into icons, if found.
Read below the legend for typical template instructions.
Icon Legend
Simply pass the template the comma separated list of terms and it will convert any found keywords to icons, and list the remainder. Although the icons have different groupings, the template doesn't care and is simply looking for keywords with an associated icon.
Expected usage:
{{Template:Auto List to Icons|List=<insert comma separated list>}}
How this works:
- Create an array called 'iconslist' of the keywords found in a query of all pages under the category Category:Infobox Icons
- Make an array called 'list' from the passed parameter names list
- Make an array called 'noiconsitems' which is the arraydiff of the first two created arrays (items on the passed list that don't have an icon)
- Make a fourth array 'iconitems' which is the intersection of the first two arrays (items on the passed list that do have an icon)
- For each iconitems, find the keyword matching image and show it
- Then finally, list the noiconsitems last
Edit the page to see the details.