Module:Infobox: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
m 1 revision imported from templatewiki:Module:Infobox
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 426: Line 434:
})
})
end

-- common functions between the child and non child cases
local function structure_infobox_common()
renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()
end
end


Line 448: Line 470:
:wikitext(args.title)
:wikitext(args.title)
end
end
structure_infobox_common()

renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()

return loadTemplateStyles() .. root
return loadTemplateStyles() .. root
end
end