Modul:Navbox: Unterschied zwischen den Versionen
Update from sandbox
(that was not "show preview" button) |
(Update from sandbox) |
||
Zeile 16: | Zeile 16: | ||
function trim(s) | function trim(s) | ||
return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")) | return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")) | ||
end | |||
function addNewline(s) | |||
if s:match('^[*:;#]') or s:match('^{|') then | |||
return '\n' .. s ..'\n' | |||
else | |||
return s | |||
end | |||
end | end | ||
Zeile 25: | Zeile 33: | ||
.css('height', '2px') | .css('height', '2px') | ||
.tag('td') | .tag('td') | ||
.attr('colspan',2) | |||
end | end | ||
Zeile 72: | Zeile 81: | ||
.attr('colspan', titleColspan) | .attr('colspan', titleColspan) | ||
renderNavBar(titleCell) | |||
titleCell | |||
.tag('div') | .tag('div') | ||
.addClass(args.titleclass) | .addClass(args.titleclass) | ||
.css('font-size', '110%') | .css('font-size', '110%') | ||
. | .wikitext(addNewline(args.title)) | ||
end | end | ||
Zeile 122: | Zeile 130: | ||
function renderAboveRow(tbl) | function renderAboveRow(tbl) | ||
if not args.above then return end | if not args.above then return end | ||
addTableRow(tbl) | addTableRow(tbl) | ||
.tag('td') | .tag('td') | ||
Zeile 131: | Zeile 139: | ||
.attr('colspan', getAboveBelowColspan()) | .attr('colspan', getAboveBelowColspan()) | ||
.tag('div') | .tag('div') | ||
. | .wikitext(addNewline(args.above)) | ||
end | end | ||
function renderBelowRow(tbl) | function renderBelowRow(tbl) | ||
if not args.below then return end | if not args.below then return end | ||
addTableRow(tbl) | addTableRow(tbl) | ||
.tag('td') | .tag('td') | ||
Zeile 146: | Zeile 153: | ||
.attr('colspan', getAboveBelowColspan()) | .attr('colspan', getAboveBelowColspan()) | ||
.tag('div') | .tag('div') | ||
. | .wikitext(addNewline(args.below)) | ||
end | end | ||
Zeile 174: | Zeile 180: | ||
.attr('rowspan', 2 * #listnums - 1) | .attr('rowspan', 2 * #listnums - 1) | ||
.tag('div') | .tag('div') | ||
. | .wikitext(addNewline(args.imageleft)) | ||
end | end | ||
Zeile 222: | Zeile 227: | ||
if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end | if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end | ||
end | end | ||
listCell | listCell | ||
.css('padding', '0px') | .css('padding', '0px') | ||
Zeile 233: | Zeile 238: | ||
.tag('div') | .tag('div') | ||
.css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em') | .css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em') | ||
. | .wikitext(addNewline(args['list' .. listnum])) | ||
if listnum == 1 and args.image then | if listnum == 1 and args.image then | ||
Zeile 246: | Zeile 250: | ||
.attr('rowspan', 2 * #listnums - 1) | .attr('rowspan', 2 * #listnums - 1) | ||
.tag('div') | .tag('div') | ||
. | .wikitext(addNewline(args.image)) | ||
end | end | ||
end | end |