Module:Igenmod: Difference between revisions
From Neodyland Wiki
More actions
m test |
m 43 revisions imported |
||
| (One intermediate revision by one other user not shown) | |||
| Line 169: | Line 169: | ||
local parind = 0; | local parind = 0; | ||
local argtab = mw.text.split( parstr, "/" ); -- becomes "|" | local argtab = mw.text.split( parstr, "/" ); -- becomes "|" | ||
local fpos = nil; | |||
for i, v in ipairs(argtab) do | for i, v in ipairs(argtab) do | ||
-- if v ~= '' then | -- if v ~= '' then | ||
v = mw.ustring.gsub( v, "¦" , "/" ) | v = mw.ustring.gsub( v, "¦" , "/" ); -- repl brokenbar by slash ,_ | ||
fpos = mw.ustring.find( v, '~' ); -- "~" becomes "=" | |||
if fpos == nil then | if fpos == nil then | ||
if v ~= '+' then | if v ~= '+' then | ||
| Line 186: | Line 187: | ||
-- end | -- end | ||
end | end | ||
if tmplte ~= ' | if mw.ustring.sub (tmplte,1,4) == 'Igen' then -- Showname | ||
table.insert( outtab, '+' ) -- re_insert the "+" | fpos = mw.ustring.find( outtab [1], ':' ); -- shortcut: | ||
if fpos ~= nil then -- "T;xx:yy" > "T", "s=xx", "w=yy" | |||
outtab['w'] = mw.ustring.sub ( outtab [1], fpos+1 ); | |||
outtab[1] = mw.ustring.sub ( outtab [1],1, fpos-1 ); | |||
end | |||
fpos = mw.ustring.find( outtab [1], ';' ); -- shortcut: | |||
if fpos ~= nil then -- "Tool;d" > "Tool", "s=d" | |||
outtab['s'] = mw.ustring.sub ( outtab [1], fpos+1 ); | |||
outtab[1] = mw.ustring.sub ( outtab [1],1, fpos-1 ); | |||
end | |||
-- if mw.ustring.sub (tmplte,5) ~= '/coa' then | |||
table.insert( outtab, '+' ); -- re_insert the "+" | |||
-- end | |||
end | end | ||
return mw.getCurrentFrame(): expandTemplate { title = tmplte, args = outtab }; | return mw.getCurrentFrame(): expandTemplate { title = tmplte, args = outtab }; | ||
end -- function q_split | end -- function q_split | ||
-- function t_split: 1 parm "templte/p1/p2/.." | -- function t_split: 1 parm "templte/p1/p2/.." | ||