Diferencia entre revisiones de «Módulo:Grid»
Página creada con «local p = {} -- Individual cell function p.cell( f ) local args = f.args or f if f == mw.getCurrentFrame() and args[1] == nil then args = f:getParent().args end arg...» |
Sin resumen de edición |
||
| (No se muestran 3 ediciones intermedias de 3 usuarios) | |||
| Línea 37: | Línea 37: | ||
if alias then | if alias then | ||
table.insert( frames, p.expandAlias( frameParts, alias ) ) | |||
else | else | ||
frames | table.insert( frames, frame ) | ||
end | end | ||
end | end | ||
| Línea 190: | Línea 179: | ||
html = table.concat( html, '' ):gsub( ' "', '"' ) | html = table.concat( html, '' ):gsub( ' "', '"' ) | ||
return html | return html | ||
end | |||
function p.expandAlias( frameParts, alias ) | |||
-- If the frame has no parts, we can just return the alias as-is | |||
if not frameParts.title and not frameParts.mod and not frameParts.num and not frameParts.text then | |||
return alias | |||
end | |||
local expandedFrames = {} | |||
for aliasFrame in mw.text.gsplit( alias, '%s*;%s*' ) do | |||
local aliasParts = p.getParts( aliasFrame ) | |||
aliasParts.title = frameParts.title or aliasParts.title or '' | |||
aliasParts.mod = frameParts.mod or aliasParts.mod or 'Minecraft' | |||
aliasParts.num = frameParts.num or aliasParts.num or '' | |||
aliasParts.text = frameParts.text or aliasParts.text or '' | |||
table.insert( expandedFrames, string.format( '[%s]%s:%s,%s[%s]', aliasParts.title, aliasParts.mod, aliasParts.name, aliasParts.num, aliasParts.text ) ) | |||
end | |||
return table.concat( expandedFrames, ';' ) | |||
end | end | ||
| Línea 336: | Línea 345: | ||
'</div>' | '</div>' | ||
} | } | ||
return table.concat( html, '\n' ); | |||
end | |||
return p | |||