View source for Module:City
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
local p = {}
function p.qCode(place)
-- recover a q-code based on place name, also if one can link to a page on commons return such link
local item, link = nil, nil
-- === STEP 1: if "place" is empty than return nothing ==============
if (not place) or (place == "") then
return item, link
end
-- === STEP 2: Check if "place" holds a q-code or matches any of the hardwired names ==============
if string.match(place, "^Q%d+$") then
return place, link -- place string contains a q-code
else
-- if multiple calls to {{City}} from a single file, than mw.loadData should load [[Module:City/data]] only once
local LookupTable = mw.loadData("Module:City/data")
item = LookupTable[mw.ustring.lower(place)]
if item then
return item, link
end
end
000
1:0
Template used on this page:
Return to Module:City.