No edit summary |
No edit summary |
||
Line 33: | Line 33: | ||
v = mw.text.trim(v) | v = mw.text.trim(v) | ||
mw.log('Siin korras 2222222') | mw.log('Siin korras 2222222') | ||
local country = CountryData[string.upper(v)] | local country = CountryData[string.upper(v)] | ||
local currentTitle = mw.title.getCurrentTitle().text | local currentTitle = mw.title.getCurrentTitle().text | ||
Line 39: | Line 38: | ||
local flag = Flags.icon(country, gameCategory) | local flag = Flags.icon(country, gameCategory) | ||
mw.log('Siin korras333333333') | mw.log('Siin korras333333333') | ||
local | local div = mw.html.create('div') | ||
:wikitext(flag) | :wikitext(flag) | ||
:wikitext(cityList[i] or country) | :wikitext(cityList[i] or country) |
Revision as of 16:52, 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(countries, cities) -- 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) -- 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 local container = mw.html.create('div') local countryList = mw.text.split(countries, ',') local cityList = mw.text.split(cities, ',') mw.log('Siin korras') for i, v in ipairs(countryList) do v = mw.text.trim(v) mw.log('Siin korras 2222222') local country = CountryData[string.upper(v)] local currentTitle = mw.title.getCurrentTitle().text local gameCategory = mw.text.split(currentTitle, '/')[1] local flag = Flags.icon(country, gameCategory) mw.log('Siin korras333333333') local div = mw.html.create('div') :wikitext(flag) :wikitext(cityList[i] or country) mw.log('Siin korras 4444444') container:node(div) end return container end return Location