Module:Navbar: Difference between revisions
Content added Content deleted
(autofill name, export _navbar, use Module:Arguments, and fix whitespace, from sandbox) |
(support collapsible version) |
||
Line 41: | Line 41: | ||
function p._navbar(args) |
function p._navbar(args) |
||
local good, title, talk_title; |
local good, title, talk_title; |
||
local titleArg = 1 |
|||
⚫ | |||
if args.collapsible then |
|||
titleArg = 2 |
|||
if not args.plain then |
|||
args.mini = 1 |
|||
end |
|||
if args.fontcolor then |
|||
args.fontstyle = 'color:' .. args.fontcolor .. ';' |
|||
end |
|||
args.style = 'float:left; text-align:left; width:6em;' |
|||
end |
|||
⚫ | |||
if not good then |
if not good then |
||
return htmlError(title); |
return htmlError(title); |
||
Line 59: | Line 72: | ||
end |
end |
||
local div = HtmlBuilder.create('div') |
local div = HtmlBuilder.create().tag('div') |
||
div |
div |
||
.addClass('plainlinks') |
.addClass('plainlinks') |
||
Line 129: | Line 142: | ||
.wikitext(']') |
.wikitext(']') |
||
.newline(); |
.newline(); |
||
end |
|||
if args.collapsible then |
|||
div |
|||
.done() |
|||
.tag('span') |
|||
.css('font-size', '110%') |
|||
.cssText(args.fontstyle or '') |
|||
.wikitext(args[1]) |
|||
end |
end |
||
return tostring(div) |
return tostring(div.allDone()) |
||
end |
end |
||