Template:Auto List to Icons: Difference between revisions

From TEHCC Wiki
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 keywords based on ask:<br>
<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>}}
Filename based on semantic keyword:<br>
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]]
{{#ask:[[Category:Infobox Icons]][[Semantic Keyword::Campground]]|mainlabel=-
|mainlabel=image
  |?File
|?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>}}
Auto table
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]]
{{List to Icons Table|userparam=intro}}
|mainlabel=image
{{#ask:[[Category:Infobox Icons]]
  |?Has Caption=description
  |?Has Caption
  |?Semantic Keyword=keyword
  |?Semantic Keyword
  |format=plainlist
  |format=template
|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:Experimental]]
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>
 
{{#arraymap:{{{1}}}
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

Image Description Semantic property
Nature Activities (hiking, biking, etc.) (Infobox Icon Type: Activities)
Boating is allowed on lakes and waterways near the park Boating
Caving opportunities, and allowed, along the trail or in the park Caving
Rock climbing opportunities, and allowed, along the trail or in the park Climbing
Signifies that ATVs are allowed on at least some of the trail
Note: Check with proper authorities for which specific trails allow it and their registration requirements
ATV
Signifies that bicycles are allowed on at least some of the trail
Note: Check with proper authorities for which specific trails allow it and their registration requirements
Biking
Signifies that camping is allowed near the trail
Note: Check with proper authorities for their registration, location, and open fire requirements
Camping
Signifies that fishing might be allowed on at least some streams nearby the trail
Note: Check with proper authorities for locations and license requirements
Fishing
Signifies that hiking is allowed on the trail Hiking
Signifies that horses are allowed on at least some of the trails
Note: Check with proper authorities for which specific trails allow it and their registration requirements
Horses
Signifies that skiing is allowed on the trail and is common in the winter Skiing
Signifies there are geocaches in the park or along the trail Geocaching
Hunting is allowed along the trail.
Note: check with local authorities for all requirements. Non-hunter hikers should also note hunting seasons.
Hunting
Signifies that either the trail does not allow dogs or if for lodging, that there are pet free cabins (Park inns are always assumed pet free unless stated otherwise) No Dogs
Features within the park or along the trail (Infobox Icon Type: Features)
There are waterfalls within the park or near the trail Waterfalls
There are navigable lakes (bigger than a pond) in the park or along the trail Lakes
There are great views of mountains or views from mountains. Mountains
There are navigable rivers (bigger than a stream) in the park or along the trail Rivers
There are scenic vistas (expansive views of beautiful nature) within the park or near the trail Vistas
Park Amenities (Infobox Icon Type: Park Amenities)
The park has a designated beach within its boundaries Beaches
The park has a disc golf course within its boundaries Disc Golf
There is a casual or fast food grill within the park Fast Food Grill
The park owns/operates a golf course within its boundaries Golf
Signifies there are sports fields (baseball, soccer, tennis, etc.) within the park Sports
The park has designated picnicking spots typically including picnic tables and possibly grills Picnicking
The park or campground has at least one playground within its boundaries Playgrounds
The park has a pool within its boundaries Pools
There is a sit down restaurant with tables and typically wait staff within the park Restaurant
Lodging options within the park (Infobox Icon Type: Lodging)
Signifies there are pet friendly cabins or lodge rooms within the park (trails and campgrounds are always assumed pet friendly unless otherwise stated) Dogs
Signifies there is a group camping site within the park Group Campground
Signifies there are cabins for overnight stays within the park. Cabins
Signifies there are backpacking sites within the park Backpacking
Signifies there is a campground within the park Campground
Signifies there is a lodge/inn/hotel within the park Lodge/Inn/Hotel
Signifies that either the trail does not allow dogs or if for lodging, that there are pet free cabins (Park inns are always assumed pet free unless stated otherwise) No Dogs
Signifies there are rustic cabins for overnight stays within the park. Typically that means remote and/or without electricity or possibly water. Rustic Cabins
Campground amenities (Infobox Icon Type: Campground Amenities)
At least some campground sites have 20 amp receptacles 20 amp electrical
At least some campground sites have 30 amp receptacles 30 amp electrical
At least some campground sites have 50 amp receptacles 50 amp electrical
Showers are available to campers Showers
Washing machine(s) and likely dryer(s) are near the campground for use (paid or otherwise) Clothes Washing
A store is available offering at least some limited selection of camping related items - see park details if more information is available Camp Store
The campground has a dump station available to campers Dump station
Water is available at some or all campground sites Site water
Wi-Fi symbol to signify that Wi-Fi is available in the campground. Wi-Fi
The park or campground has at least one playground within its boundaries Playgrounds
Campground campsites offered that do not permit RV's Tent only

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.