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 13: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)
Canoe.jpg
Boating is allowed on lakes and waterways near the park Boating
Caving icon.png
Caving opportunities, and allowed, along the trail or in the park Caving
Climbing icon.png
Rock climbing opportunities, and allowed, along the trail or in the park Climbing
Dnr atv.png
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
Dnr bike.png
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
Dnr camp.png
Signifies that camping is allowed near the trail
Note: Check with proper authorities for their registration, location, and open fire requirements
Camping
Dnr fishing.png
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
Dnr hiking.png
Signifies that hiking is allowed on the trail Hiking
Dnr horse.png
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
Dnr skiing.png
Signifies that skiing is allowed on the trail and is common in the winter Skiing
Icon Geocaching.jpg
Signifies there are geocaches in the park or along the trail Geocaching
Icon Hunting.jpg
Hunting is allowed along the trail.
Note: check with local authorities for all requirements. Non-hunter hikers should also note hunting seasons.
Hunting
No Dogs icon.jpg
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)
Dnr waterfall.png
There are waterfalls within the park or near the trail Waterfalls
Lakes icon.png
There are navigable lakes (bigger than a pond) in the park or along the trail Lakes
Mountains icon.png
There are great views of mountains or views from mountains. Mountains
Rivers icon.png
There are navigable rivers (bigger than a stream) in the park or along the trail Rivers
Scenic vistas icon.png
There are scenic vistas (expansive views of beautiful nature) within the park or near the trail Vistas
Park Amenities (Infobox Icon Type: Park Amenities)
Beaches icon.jpg
The park has a designated beach within its boundaries Beaches
Disc Golf icon.jpg
The park has a disc golf course within its boundaries Disc Golf
FastFoodIcon.png
There is a casual or fast food grill within the park Fast Food Grill
Golfing.png
The park owns/operates a golf course within its boundaries Golf
Icon Sports.png
Signifies there are sports fields (baseball, soccer, tennis, etc.) within the park Sports
Picnic icon.png
The park has designated picnicking spots typically including picnic tables and possibly grills Picnicking
Playground icon.png
The park or campground has at least one playground within its boundaries Playgrounds
Pool icon.jpg
The park has a pool within its boundaries Pools
RestaurantIcon.jpg
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)
Dnr dog.png
Signifies there are pet friendly cabins or lodge rooms within the park (trails and campgrounds are always assumed pet friendly unless otherwise stated) Dogs
Group camping icon.png
Signifies there is a group camping site within the park Group Campground
Icon Cabin.png
Signifies there are cabins for overnight stays within the park. Cabins
Icon backpacking.jpg
Signifies there are backpacking sites within the park Backpacking
Icon campground.png
Signifies there is a campground within the park Campground
Icon lodge.png
Signifies there is a lodge/inn/hotel within the park Lodge/Inn/Hotel
No Dogs icon.jpg
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
Rustic Cabins icon.png
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)
Icon 20 amp.png
At least some campground sites have 20 amp receptacles 20 amp electrical
Icon 30 amp.png
At least some campground sites have 30 amp receptacles 30 amp electrical
Icon 50 amp.png
At least some campground sites have 50 amp receptacles 50 amp electrical
Icon Showers.png
Showers are available to campers Showers
Icon Washing.png
Washing machine(s) and likely dryer(s) are near the campground for use (paid or otherwise) Clothes Washing
Icon dollar.jpg
A store is available offering at least some limited selection of camping related items - see park details if more information is available Camp Store
Icon dump station.png
The campground has a dump station available to campers Dump station
Icon water.jpg
Water is available at some or all campground sites Site water
Icon wifi.jpg
Wi-Fi symbol to signify that Wi-Fi is available in the campground. Wi-Fi
Playground icon.png
The park or campground has at least one playground within its boundaries Playgrounds
Tent only icon.png
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.