No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
while not String.isEmpty(current) do | while not String.isEmpty(current) do | ||
local country = CountryData[string.upper(current)] | local country = CountryData[string.upper(current)] | ||
local currentTitle = mw.title.getCurrentTitle().text | local currentTitle = mw.title.getCurrentTitle().text | ||
local gameCategory = mw.text.split(currentTitle, '/')[1] | local gameCategory = mw.text.split(currentTitle, '/')[1] | ||
Line 21: | Line 18: | ||
mw.log('flag: ' .. flag) | mw.log('flag: ' .. flag) | ||
local countryNode = mw.html.create('div') | local countryNode = mw.html.create('div') | ||
: | :wikitext(flag) | ||
:wikitext(country) | :wikitext(country) | ||
container:node( | container:node(countryNode) | ||
index = index + 1 | index = index + 1 |
Revision as of 16:38, 30 August 2022
Documentation for this module may be created at Module:Infobox/Widget/Location/doc
local CountryData = mw.loadData('Module:Localisation/Data') local Flags = require('Module:Flags') local String = require('Module:StringUtils') local Location = {} function Location.make(args) local index = 1 local current = args['country'] local currentLocation = args['city'] or args['location'] local container = mw.html.create('div') while not String.isEmpty(current) do local country = CountryData[string.upper(current)] local currentTitle = mw.title.getCurrentTitle().text local gameCategory = mw.text.split(currentTitle, '/')[1] local flag = Flags.icon(country, gameCategory) mw.log('flag: ' .. flag) local countryNode = mw.html.create('div') :wikitext(flag) :wikitext(country) container:node(countryNode) index = index + 1 current = args['country' .. index] currentLocation = args['city' .. index] or args['location' .. index] end return container end return Location