Mòdul:Jmarchn/Proves3
Aparença
Podeu crear la pàgina d'ús per documentar aquest mòdul Lua. |
local p = {}
local SD = require "Module:SimpleDebug"
function p.trimChromosome(string_to_trim)
local out = nil
local pas = ''
local pas2 = 'no'
if (string_to_trim == nil) or (string_to_trim == nil) then
out = ''
error(SD.v(string_to_trim, out))
elseif string.find(string_to_trim, 'Cromosoma mitocondrial') or string.find(string_to_trim, 'mitocondri') then --match both 'mitochondrio'/'mitochondrial'
out = "MT"
elseif string.find(string_to_trim, 'Cromosoma') then --**lclz** Add your local label, otherwise it may break
error(SD.w('aquí'))
out = string.match(string_to_trim, "%d+")--extract number from string
error(SD.v(out))
if out == nil then
pas = string.find(string_to_trim, "X")
pas2 = 'sí'
out = pas or string.find(string_to_trim, "Y")
end
end
error(SD.nv('s_to_t', string_to_trim,
'out', out,
'pas', pas,
'pas2', pas2))
--'X', string.match(string_to_trim, "X"),
--'Y', string.match(string_to_trim, "Y")))
return out
end
function p.getTemplateData(frame)
local entity = {}
local entity_mouse = {}
local root_qid = mw.text.trim(frame.args['QID'] or "") --try to get it from the args
entity = mw.wikibase.getEntity(root_qid)
local chr = require("Module:Wikidades").claim{item=root_qid, property="P1057"}
return p.trimChromosome (chr)
end
return p