894
suntingan
Mediawiki>Frietjes (fix for {{infobox}} with no input args generating an empty <table class="infobox"></table> per talk page) |
k (1 revisi diimpor) |
||
| Baris 5: | Baris 5: | ||
local empty_row_categories = {} | local empty_row_categories = {} | ||
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' | local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' | ||
local function fixChildBoxes(sval, tt) | local function fixChildBoxes(sval, tt) | ||
| Baris 57: | Baris 56: | ||
else | else | ||
return sval | return sval | ||
end | end | ||
end | end | ||
| Baris 103: | Baris 94: | ||
if rowArgs.header and rowArgs.header ~= '_BLANK_' then | if rowArgs.header and rowArgs.header ~= '_BLANK_' then | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Baris 125: | Baris 115: | ||
category_in_empty_row_pattern, '' | category_in_empty_row_pattern, '' | ||
):match('^%S') then | ):match('^%S') then | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(rowArgs.rowclass) | row:addClass(rowArgs.rowclass) | ||
| Baris 158: | Baris 147: | ||
if not args.title then return end | if not args.title then return end | ||
root | root | ||
:tag('caption') | :tag('caption') | ||
| Baris 171: | Baris 159: | ||
if not args.above then return end | if not args.above then return end | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Baris 186: | Baris 173: | ||
if not args.below then return end | if not args.below then return end | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Baris 201: | Baris 187: | ||
if subheaderArgs.data and | if subheaderArgs.data and | ||
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(subheaderArgs.rowclass) | row:addClass(subheaderArgs.rowclass) | ||
| Baris 242: | Baris 227: | ||
if imageArgs.data and | if imageArgs.data and | ||
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(imageArgs.rowclass) | row:addClass(imageArgs.rowclass) | ||
| Baris 340: | Baris 324: | ||
if not args.name then return end | if not args.name then return end | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Baris 458: | Baris 441: | ||
renderEmptyRowCategories() | renderEmptyRowCategories() | ||
renderTrackingCategories() | renderTrackingCategories() | ||
return loadTemplateStyles() .. root | return loadTemplateStyles() .. tostring(root) | ||
end | end | ||