Module:Navbar/sandbox: Difference between revisions

Content deleted Content added
put some sane limits
tweak, fix use of _navbar
Line 2:
 
local getArgs
local ul
local args
 
function p.addItem _navbar(mini, full, link, descrip, urlargs)
local l
if url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-'..full)
:wikitext(l[1] .. link .. l[2])
:tag(args.mini and 'abbr' or 'span')
:attr('title', descrip..' this template')
:cssText(args.fontstyle)
:wikitext(args.mini and mini or full)
:done()
:wikitext(l[3])
end
 
function p._navbar()
local show = {true, true, true, false, false, false}
local titleArg = 1
Line 88 ⟶ 68:
:wikitext('[ ')
end
 
ul = div:tag('ul')
local moveul = mw.title.new div:tag('Special:Movepageul')
if show[1] then p.addItem('v', 'view', title.fullText, 'View') end
iflocal show[2]function then p.addItem ('t'mini, 'talk'full, talkpagelink, 'Discuss')descrip, endurl)
local ull
if show[3] then p.addItem('e', 'edit', title:fullUrl('action=edit'), 'Edit', true) end
if url then
if show[4] then p.addItem('h', 'hist', title:fullUrl('action=history'), 'History of', true) end
l = {'[', '', ']'}
if show[5] then p.addItem('m', 'move', move:fullUrl('target='..title.fullText), 'Move', true) end
else
if show[6] then p.addItem('w', 'watch', title:fullUrl('action=watch'), 'Watch', true) end
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-'..full)
:wikitext(l[1] .. link .. l[2])
:tag(args.mini and 'abbr' or 'span')
:attr('title', descrip..' this template')
:cssText(args.fontstyle)
:wikitext(args.mini and mini or full)
:done()
:wikitext(l[3])
end
if show[1] then p.addItem('v', 'view', title.fullText, 'View') end
if show[2] then addItem('t', 'talk', talkpage, 'Discuss') end
if show[3] then p.addItem('e', 'edit', title:fullUrl('action=edit'), 'Edit', true) end
if show[4] then p.addItem('h', 'hist', title:fullUrl('action=history'), 'History of', true) end
if show[5] then
local move = mw.title.new ('Special:Movepage')
if show[5] then p. addItem('m', 'move', move:fullUrl('target='..title.fullText), 'Move', true) end
if show[6] then p.addItem('w', 'watch', title:fullUrl('action=watch'), 'Watch', true) end
if args.brackets then
Line 122 ⟶ 123:
getArgs = require('Module:Arguments').getArgs
end
args =return p._navbar(getArgs(frame))
return p._navbar()
end