Module:Infobox: Difference between revisions
Appearance
nix |
(1) return templatestyles when child=yes, (2) move templatestyles and categories before </tr> to avoid creating empty cells (see thread on talk page) |
||
Line 13: | Line 13: | ||
local marker = '<span class=special_infobox_marker>' | local marker = '<span class=special_infobox_marker>' | ||
local s = sval | local s = sval | ||
-- start moving templatestyles and categories inside of table rows | |||
local slast = '' | |||
while slast ~= s do | |||
slast = s | |||
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') | |||
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(<templatestyles[^<>]*>%s*</templatestyles>)', '%2%1') | |||
end | |||
-- end moving templatestyles and categories inside of table rows | |||
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') | s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') | ||
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) | s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) | ||
Line 123: | Line 131: | ||
end | end | ||
elseif rowArgs.data and rowArgs.data:gsub( | elseif rowArgs.data and rowArgs.data:gsub( | ||
category_in_empty_row_pattern, '' | |||
):match('^%S') then | ):match('^%S') then | ||
has_rows = true | has_rows = true | ||
Line 456: | Line 464: | ||
renderTitle() | renderTitle() | ||
renderAboveRow() | renderAboveRow() | ||
else | else | ||
root = mw.html.create() | root = mw.html.create() | ||
Line 464: | Line 469: | ||
root | root | ||
:wikitext(args.title) | :wikitext(args.title) | ||
end | end | ||
structure_infobox_common() | |||
return loadTemplateStyles() .. root | |||
end | end | ||