Difference between revisions of "Module:Sandbox/Galobtter/Short description from country"
< Module:Sandbox | Galobtter
Jump to navigation
Jump to search
blackwiki>Galobtter (tweak) |
blackwiki>Galobtter (tweak) |
||
| Line 3: | Line 3: | ||
--data = mw.loaddata("Module:Short description from country/data") | --data = mw.loaddata("Module:Short description from country/data") | ||
local p = {} | local p = {} | ||
| − | |||
function p.main (frame) | function p.main (frame) | ||
| Line 9: | Line 8: | ||
return | return | ||
end | end | ||
| + | local getArgs = require('Module:Arguments') | ||
local args = getArgs(frame, 'frameOnly') | local args = getArgs(frame, 'frameOnly') | ||
local parentArgs = getArgs(frame, 'parentOnly') | local parentArgs = getArgs(frame, 'parentOnly') | ||
Revision as of 13:57, 12 April 2018
Documentation for this module may be created at Module:Sandbox/Galobtter/Short description from country/doc
--given a pattern input like "country%d", if there is only one of it (excluding youth teams of the same country etc), give "nationality profession", e.g "German association football player"
--data = mw.loaddata("Module:Short description from country/data")
local p = {}
function p.main (frame)
if args.disable == 'yes' then
return
end
local getArgs = require('Module:Arguments')
local args = getArgs(frame, 'frameOnly')
local parentArgs = getArgs(frame, 'parentOnly')
local name = args[1]
local vals = {}
local nationatString
for m, n in pairs (parentArgs) do
if string.find(m, "^"+name+"$") then
n:gsub(" U%d$", "") --strip U23 etc
if nationString then
if n ~= nationString then
return
end
else
nationString = n
end
end
end
return nationString..args[2] --data[nationString]
end
return p