Module:ATC code to template name/ja: Difference between revisions
Jump to navigation
Jump to search
Created page with "-- this module provides a lookup from ATC codes to their associated navbox templates -- local data = mw.loadData("Module:ATC code to template name/data/ja") p = {} function p.translate(frame) local name = frame.args[1] for _, v in pairs(data) do if v.code == name then if v.template then return frame:expandTemplate{ title = v.template } else error("ATC code not specific enough - please use one further character (example: instead of M01, use M01A)")..." |
(No difference)
|
Latest revision as of 13:44, 5 April 2024
Documentation for this module may be created at Module:ATC code to template name/ja/doc
-- this module provides a lookup from ATC codes to their associated navbox templates --
local data = mw.loadData("Module:ATC code to template name/data/ja")
p = {}
function p.translate(frame)
local name = frame.args[1]
for _, v in pairs(data) do
if v.code == name then
if v.template then
return frame:expandTemplate{ title = v.template }
else
error("ATC code not specific enough - please use one further character (example: instead of M01, use M01A)")
return
end
end
end
error("Invalid ATC code (or the ATC code does not have a template matched to it)")
return
end
return p