Module:Infobox: Difference between revisions

Reverted good faith edits by Izno (talk): This edit appears to cause extraordinarily high spaces between lines on Template:Infobox officeholder.
m (1 revision imported)
(Reverted good faith edits by Izno (talk): This edit appears to cause extraordinarily high spaces between lines on Template:Infobox officeholder.)
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, ''
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()
structure_infobox_common()
return loadTemplateStyles() .. root
else
else
root = mw.html.create()
root = mw.html.create()
Line 464: Line 469:
root
root
:wikitext(args.title)
:wikitext(args.title)
structure_infobox_common()
return root
end
end
structure_infobox_common()
return loadTemplateStyles() .. root
end
end


Anonymous user