Editing Template:Auto List to Icons

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
<noinclude>This template converts keywords into icons, if found.
<noinclude>Semantic keywords based on ask:<br>
{{#ask:[[Category:Infobox Icons]]|mainlabel=-
|?Semantic Keyword
|headers=hide
}}


Read below the legend for typical template instructions.
Filename based on semantic keyword:<br>
{{#ask:[[Category:Infobox Icons]][[Semantic Keyword::Campground]]|mainlabel=-
|?File
|headers=hide
|link=none
}}


Icon Legend
Auto table
{{List to Icons Table|#userparam=intro}}
{{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>}}
{{List to Icons Table|#userparam=header|header=Nature Activities (hiking, biking, etc.)}}
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Activities]]
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Activities]]
  |mainlabel=image
  |mainlabel=image
Line 17: Line 26:
  |named args=yes
  |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>}}
{{List to Icons Table|#userparam=header|header=Park Amenities}}
{{#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]]
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Park Amenities]]
  |mainlabel=image
  |mainlabel=image
Line 41: Line 38:
  |named args=yes
  |named args=yes
}}
}}
{{List to Icons Table|#userparam=header|header=<div id="lodging">Lodging options within the park (Infobox Icon Type: Lodging)</div>}}
{{List to Icons Table|#userparam=header|header=Lodging options within the park}}
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]]
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]]
  |mainlabel=image
  |mainlabel=image
Line 53: Line 50:
  |named args=yes
  |named args=yes
}}
}}
{{List to Icons Table|#userparam=header|header=<div id="campground">Campground amenities (Infobox Icon Type: Campground Amenities)</div>}}
{{List to Icons Table|#userparam=header|header=Campground ammenities}}
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]]
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]]
  |mainlabel=image
  |mainlabel=image
Line 67: Line 64:
{{List to Icons Table|#userparam=outro}}
{{List to Icons Table|#userparam=outro}}


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.
[[Category:Experimental]]
 
</noinclude><includeonly>
Expected usage:
{{#arraymap:{{{1}}}
<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 103: Line 73:
   |headers=hide
   |headers=hide
   |link=none
   |link=none
  |limit=1
  }}|25px|@@@@]]
  }}|25px|@@@@]]
  |
  |
}}<!--
}}
--><br>{{#arrayprint:noiconitems}}
</includeonly>
</includeonly>
Please note that all contributions to TEHCC Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see TEHCC Wiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: