Module:هېواد لېږد
ښکارېدونکې بڼه
لاسوند لپاره ددې موډيول کېدای سی په Module:هېواد لېږد/لاسوند کي وي
local p = {}
function getaliases(Country, data)
s = mw.ustring.gsub(Country, "_", " ")
local all= require('Module:هېواد مخګرځي مالومات')
for k, nam in pairs(all) do
for i, v in pairs(nam) do
if s == v
then
return nam.na
end
end
end
end
function p.red(Country)
if Country and Country~= '' then
val = getaliases(Country,'data')
if val and val~= ''
then
return val
else
return Country
end
end
end
function p.map(Country)
if Country and Country~= '' then
val = getaliases(Country,'mapdata')
if val and val~= ''
then
return val
else
return Country
end
end
end
function p.redirect(frame)
return p.red(frame.args[1])
end
function p.refirect(frame)
return p.red(frame.args[1])
end
function p.list_all(frame)
--Load data
local alt_map = require('Module:هېواد مخګرځي مالومات')
for k, nam in pairs(alt_map) do
for i, v in pairs(nam) do
name= v.na
end
end
local list = mw.html.create("table")
list:addClass("wikitable sortable collapsible")
local head = list:tag("tr")
head:tag("th"):wikitext("بنسټيزه کينډۍ")
head:tag("th"):wikitext("مخګرځ")
for o, nam in pairs(alt_map) do
local temp = nam.na-- or k
local row = list:tag("tr")
local th = row:tag("td")
local rr = row:tag("td")
local d = frame.args.template.. ' '
local dd = "\n[[template:".. d .. temp .."|".. temp .. "]]"
th:tag("span"):wikitext(dd)
for k,v in pairs(nam) do
local cc = {}
if v == temp then v = nil end
if v and v ~= '' then
u = "[[template:".. d .. v .."|".. v .. "]]"
end
rr:tag("code"):wikitext(u)
rr:tag("span"):wikitext(' - ')
end
end
return list
end
return p