Mòdul:ATC
Aparença
Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]
A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]
Utilitzat en {{ATC WD}} i {{ATCvet WD}}
{{#invoke:ATC|ATC|N01AA01}} -> N01</spaN01AA01 AA01
{{#invoke:ATC|ATCvet|QP51AA01}} -> QP51</spaQP51AA01 AA01
p={}
local SA = require "Module:SimpleArgs"
local WD = require "Module:Wikidades"
-- Code languge of wiki {Beginning of ATC code article, Character number used for suffix}
-- i. e. with A01AB17
-- 'ATC (%s)' will be replaced by 'ATC (A01)', because de character number is 3
-- 'Kode ATC %s' will be replaced by 'ATC code A', because de character number is 1
local Code = {
ca = {'Codi ATC %s', 3},
cs = {'ATC kód %s', 3},
el = {'Κωδικοί ATC %s', 1},
en = {'ATC code %s', 3},
es = {'Anexo:Código ATC %s',3},
fa = {'ATC code %s', 3},
fi = {'ATC-koodi %s', 1},
fr = {'Classe ATC %s', 3},
gl = {'Código ATC %s', 1},
hu = {'ATC %s', 3},
id = {'Kode ATC %s', 1},
it = {'Codice ATC %s', 3},
ko = {'ATC 코드 %s', 3},
la = {'Codex ATC %s', 3},
mk = {'ATC код %s', 3},
pl = {'ATC (%s)', 3},
pt = {'Código ATC %s', 1},
ro = {'Cod ATC %s', 3},
ru = {'АТХ-%s', 1},
sh = {'ATC kod %s', 3},
sl = {'ATC-koda %s', 1},
sr = {'ATC kod %s', 3},
sv = {'ATC-kod %s', 3},
th = {'ATC รหัส%s ', 3},
zh = {'ATC代码 (%s)', 3},
}
local function ATC0 (frame, Shift, Pref, Item)
local lang = mw.language.getContentLanguage():getCode()
local args,Nargs = SA.GetArgs (frame)
local ATC = args[1]
local Lnk = WD.claim({item=Item, property="P1630"})
Lnk = string.sub (Lnk, 1, string.len(Lnk)-2)..ATC
if Code[lang] == nil then
return '['..Lnk..' '..ATC..']'
else
local Prefix = string.sub (ATC, 1+Shift, Code[lang][2]+Shift)
local Sufix = string.sub (ATC, Code[lang][2]+1+Shift)
Lnk = '['..Lnk..' '..Sufix..']'
return '[['..string.format(Code[lang][1], Prefix)..'|'..Pref..Prefix..']]<span class="reflink plainlinks nourlexpansion">'..Lnk..'</span>'
end
end --ATC0
function p.ATC (frame)
return ATC0 (frame, 0, '', 'P267')
end
function p.ATCvet (frame)
return ATC0 (frame, 1, 'Q', 'P1668')
end
return p