Module:ATC code to template name
Appearance
Translates an ATC code passed as an unnamed parameter to the function "translate" into the name of the navbox template associated with that ATC code on Wikipedia.
Use:
{{#invoke:ATC code to template name|translate|X00}}
The template returned does not have the Template: prefix.
-- this module provides a lookup from ATC codes to their associated navbox templates --
local p = {}
local input = frame.args[1]
p.lookuptable = {
{ code="A01", template="Stomatological preparations",},
{ code="A02A", template="Antacids", },
{ code="A02B", template="Drugs for peptic ulcer and GORD", },
{ code="A03", template="Drugs for functional gastrointestinal disorders", },
{ code="A04", template="Antiemetics", },
}
local function translate ( param )
for k,v in pairs(p.lookuptable) do
if v.code == param then
p.out = v.template
print(p.out)
end
end
if p.out == nil then
error("None")
end
return p.out
end
return p