|
|
| വരി 1: |
വരി 1: |
| local p = {} --p stands for package | | function p.list(frame) |
| | local outputTable = {} |
| | local hasDescriptions = false |
|
| |
|
| p.numbers = {}
| | for key, icon in pairs(p.icons) do |
| for i = 1, 99 do | | -- Use the icon variable for the correct file reference |
| table.insert( p.numbers, "-number" )
| | table.insert(outputTable, '|-\n| [[File:Maki7-' .. icon .. '.svg|18px]] || ' .. icon) |
| end
| |
| | |
| p.letters = {}
| |
| for i = 1, 26 do | |
| table.insert( p.letters, "-letter" )
| |
| end
| |
|
| |
|
| p.icons = {
| | -- Check for and include descriptions if available |
| "aerialway",
| | local helpText = frame.args[icon] or frame:getParent().args[icon] |
| "airfield",
| | if helpText then |
| "airport",
| | table.insert(outputTable, ' || ' .. helpText) |
| "alcohol-shop",
| | hasDescriptions = true |
| "american-football",
| | end |
| "amusement-park",
| |
| "animal-shelter",
| |
| "aquarium",
| |
| "arrow",
| |
| "art-gallery",
| |
| "attraction",
| |
| "bakery",
| |
| "bank-JP",
| |
| "bank",
| |
| "bar",
| |
| "barrier",
| |
| "baseball",
| |
| "basketball",
| |
| "bbq",
| |
| "beach",
| |
| "beer",
| |
| "bicycle-share",
| |
| "bicycle",
| |
| "blood-bank",
| |
| "bowling-alley",
| |
| "bridge",
| |
| "building-alt1",
| |
| "building",
| |
| "bus",
| |
| "cafe",
| |
| "campsite",
| |
| "car-rental",
| |
| "car-repair",
| |
| "car",
| |
| "casino",
| |
| "castle-JP",
| |
| "castle",
| |
| "caution",
| |
| "cemetery-JP",
| |
| "cemetery",
| |
| "charging-station",
| |
| "cinema",
| |
| "circle-stroked",
| |
| "circle",
| |
| "city",
| |
| "clothing-store",
| |
| "college-JP",
| |
| "college",
| |
| "commercial",
| |
| "communications-tower",
| |
| "confectionery",
| |
| "construction",
| |
| "convenience",
| |
| "cricket",
| |
| "cross",
| |
| "dam",
| |
| "danger",
| |
| "defibrillator",
| |
| "dentist",
| |
| "diamond",
| |
| "doctor",
| |
| "dog-park",
| |
| "drinking-water",
| |
| "elevator",
| |
| "embassy",
| |
| "emergency-phone",
| |
| "entrance-alt1",
| |
| "entrance",
| |
| "farm",
| |
| "fast-food",
| |
| "fence",
| |
| "ferry-JP",
| |
| "ferry",
| |
| "fire-station-JP",
| |
| "fire-station",
| |
| "fitness-centre",
| |
| "florist",
| |
| "fuel",
| |
| "furniture",
| |
| "gaming",
| |
| "garden-centre",
| |
| "garden",
| |
| "gate",
| |
| "gift",
| |
| "globe",
| |
| "golf",
| |
| "grocery",
| |
| "hairdresser",
| |
| "harbor",
| |
| "hardware",
| |
| "heart",
| |
| "heliport",
| |
| "highway-rest-area",
| |
| "historic",
| |
| "home",
| |
| "horse-riding",
| |
| "hospital-JP",
| |
| "hospital",
| |
| "hot-spring",
| |
| "ice-cream",
| |
| "industry",
| |
| "information",
| |
| "jewelry-store",
| |
| "karaoke",
| |
| "landmark-JP",
| |
| "landmark",
| |
| "landuse",
| |
| "laundry",
| |
| "library",
| |
| "lift-gate",
| |
| "lighthouse-JP",
| |
| "lighthouse",
| |
| "lodging",
| |
| "logging",
| |
| "marker-stroked",
| |
| "marker",
| |
| "mobile-phone",
| |
| "monument-JP",
| |
| "monument",
| |
| "mountain",
| |
| "museum",
| |
| "music",
| |
| "natural",
| |
| "observation-tower",
| |
| "optician",
| |
| "paint",
| |
| "park-alt1",
| |
| "park",
| |
| "parking-garage",
| |
| "parking-paid",
| |
| "parking",
| |
| "pharmacy",
| |
| "picnic-site",
| |
| "pitch",
| |
| "place-of-worship",
| |
| "playground",
| |
| "police-JP",
| |
| "police",
| |
| "post-JP",
| |
| "post",
| |
| "prison",
| |
| "racetrack-boat",
| |
| "racetrack-cycling",
| |
| "racetrack-horse",
| |
| "racetrack",
| |
| "rail-light",
| |
| "rail-metro",
| |
| "rail",
| |
| "ranger-station",
| |
| "recycling",
| |
| "religious-buddhist",
| |
| "religious-christian",
| |
| "religious-jewish",
| |
| "religious-muslim",
| |
| "religious-shinto",
| |
| "residential-community",
| |
| "restaurant-bbq",
| |
| "restaurant-noodle",
| |
| "restaurant-pizza",
| |
| "restaurant-seafood",
| |
| "restaurant-sushi",
| |
| "restaurant",
| |
| "road-accident",
| |
| "roadblock",
| |
| "rocket",
| |
| "school-JP",
| |
| "school",
| |
| "scooter",
| |
| "shelter",
| |
| "shoe",
| |
| "shop",
| |
| "skateboard",
| |
| "skiing",
| |
| "slaughterhouse",
| |
| "slipway",
| |
| "snowmobile",
| |
| "soccer",
| |
| "square-stroked",
| |
| "square",
| |
| "stadium",
| |
| "star-stroked",
| |
| "star",
| |
| "suitcase",
| |
| "swimming",
| |
| "table-tennis",
| |
| "teahouse",
| |
| "telephone",
| |
| "tennis",
| |
| "theatre",
| |
| "toilet",
| |
| "toll-booth",
| |
| "town-hall",
| |
| "town",
| |
| "triangle-stroked",
| |
| "triangle",
| |
| "tunnel",
| |
| "veterinary",
| |
| "viewpoint",
| |
| "village",
| |
| "volcano",
| |
| "volleyball",
| |
| "warehouse",
| |
| "waste-basket",
| |
| "watch",
| |
| "water",
| |
| "waterfall",
| |
| "watermill",
| |
| "wetland",
| |
| "wheelchair",
| |
| "windmill",
| |
| "zoo"
| |
| }
| |
|
| |
|
| p.step = 0.08
| | table.insert(outputTable, '\n') |
| p.columnCount = 15
| | end |
|
| |
|
| function p.grid( frame )
| | -- Table header |
| local iconKey = frame.args.icons or "icons"
| | local tableHeader = [[ |
| local iconList = p[iconKey]
| | {|class="wikitable" |
| local height = math.floor( math.ceil( #iconList / p.columnCount ) * p.step * 729 + 80 )
| | |+ {{int:kartographer-icon-docs-table}} |
| | ! {{int:kartographer-icon-docs-icon}} !! {{int:kartographer-icon-docs-key}} |
| | ]] |
| | if hasDescriptions then |
| | tableHeader = tableHeader .. '!! {{int:kartographer-icon-docs-help}}' |
| | end |
| | table.insert(outputTable, 1, tableHeader .. '\n') |
|
| |
|
| return frame:preprocess(
| | -- Table footer |
| '<mapframe text="Maki Icons" width="1000" height="'
| | table.insert(outputTable, '|}') |
| .. height
| |
| .. [[" align="right" zoom="10">
| |
| {
| |
| "type": "FeatureCollection",
| |
| "features": [
| |
| ]]
| |
| .. table.concat( p.coordGrid( iconList ), ",\n " )
| |
| .. [[
| |
| ]
| |
| } | |
| </mapframe>]]
| |
| )
| |
| end
| |
|
| |
|
| function p.coordGrid( iconList )
| | return frame:preprocess(table.concat(outputTable)) |
| local outputTable = {}
| |
| local iconIndex = 1
| |
| -- Stop iterating rows when we run out of icons.
| |
| for y = 0, 999, p.step do
| |
| for x = 0, ( p.columnCount - 1 ) * p.step, p.step do
| |
| local icon = iconList[iconIndex]
| |
| if not icon then
| |
| return outputTable
| |
| end
| |
| -- Positive Y is up, so negate to read top-to-bottom.
| |
| table.insert( outputTable, '{ "type": "Feature", '
| |
| .. '"geometry": { "type": "Point", "coordinates": [ '
| |
| .. x
| |
| .. ', -'
| |
| .. y
| |
| .. ' ] }, '
| |
| .. '"properties": { "title": "\\"marker-symbol\\": \\"'
| |
| .. icon
| |
| .. '\\"", "marker-symbol": "'
| |
| .. icon
| |
| .. '", "marker-color": "54595d", "marker-size": "large" } }'
| |
| )
| |
| iconIndex = iconIndex + 1
| |
| end
| |
| end
| |
| end | | end |
|
| |
| function p.list ( frame )
| |
| local outputTable = {}
| |
| local hasDescriptions = false
| |
|
| |
| for key, icon in pairs( p.icons ) do
| |
| table.insert( outputTable, '|-\n| [[File:Maki7-' ..icon.. '.svg|18px]] || ' .. icon )
| |
|
| |
| local helpText = frame.args[icon] or frame:getParent().args[icon]
| |
| if helpText then
| |
| table.insert( outputTable, ' || ' .. helpText )
| |
| hasDescriptions = true
| |
| end
| |
|
| |
| table.insert( outputTable, '\n' )
| |
| end
| |
|
| |
| local tableHeader = [[
| |
| {|class="wikitable"
| |
| |+ {{int:kartographer-icon-docs-table}}
| |
| ! {{int:kartographer-icon-docs-icon}} !! {{int:kartographer-icon-docs-key}}
| |
| ]]
| |
| if hasDescriptions then
| |
| tableHeader = tableHeader .. '!! {{int:kartographer-icon-docs-help}}'
| |
| end
| |
| table.insert( outputTable, 1, tableHeader .. '\n' )
| |
|
| |
| table.insert( outputTable, '|}' )
| |
|
| |
| return frame:preprocess( table.concat( outputTable ) )
| |
| end
| |
|
| |
| return p
| |