Content deleted Content added
see if this breaks Tag: Reverted |
m Removed protection from "Module:Navbar/sandbox" |
||
(38 intermediate revisions by 8 users not shown) | |||
Line 13:
-- view, talk, edit, hist, move, watch
-- TODO: Move to configuration.
local show =
if template then
show[2] = false
Line 33:
end
local function
local l
if link_description.url then
Line 50:
:wikitext(l[3])
:done()
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
if not title then▼
end▼
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''▼
-- TODO: Get link_descriptions and show into the configuration module.▼
-- link_descriptions should be easier...▼
local link_descriptions = {▼
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',▼
['link'] = title.fullText, ['url'] = false },▼
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',▼
['link'] = talkpage, ['url'] = false },▼
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',▼
['link'] =
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',▼
['link'] =
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',▼
['link'] = mw.title.new('Special:Movepage'):fullUrl('
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ▼
['link'] = title:fullUrl('action=watch'), ['url'] = true }▼
}▼
local ul = mw.html.create('ul')▼
if has_brackets then▼
ul:addClass(cfg.classes.brackets)▼
:cssText(font_style)▼
end▼
for i, _ in ipairs(displayed_links) do▼
end
return ul:done()▼
end
Line 92 ⟶ 130:
local template = args.template
local titleArg = get_title_arg(is_collapsible, template)▼
local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle())▼
▲ local title = mw.title.new(mw.text.trim(titleText), cfg.title_namespace)
▲ if not title then
▲ error(cfg.invalid_title .. titleText)
▲ end
▲ local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
▲ -- TODO: Get link_descriptions and show into the configuration module.
▲ -- link_descriptions should be easier...
▲ local link_descriptions = {
▲ { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
▲ ['link'] = title.fullText, ['url'] = false },
▲ { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
▲ ['link'] = talkpage, ['url'] = false },
▲ { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
▲ ['link'] = title:fullUrl('action=edit'), ['url'] = true },
▲ { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
▲ ['link'] = title:fullUrl('action=history'), ['url'] = true },
▲ { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
▲ ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
▲ { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
▲ ['link'] = title:fullUrl('action=watch'), ['url'] = true }
▲ }
local has_brackets = args.brackets▼
▲ local ul = mw.html.create('ul')
▲ if has_brackets then
▲ ul:addClass(cfg.classes.brackets)
▲ :cssText(font_style)
▲ end
local displayed_links = choose_links(template, args)
▲ local has_brackets = args.brackets
▲ for i, _ in ipairs(displayed_links) do
▲ local
▲ if displayed_links[i] then addItem(link_descriptions[i], ul, is_mini, font_style) end
local links = ''
▲ end
if args.vte_links_override then
▲ ul:done()
links = args.vte_links_override
div:node(ul)▼
div:wikitext(links)
else
links = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
end
if is_collapsible then
Line 145 ⟶ 156:
:wikitext(args[1])
end
local frame = mw.getCurrentFrame()
-- hlist -> navbar is best-effort to preserve old Common.css ordering.
return
name = 'templatestyles', args = { src = cfg.hlist_templatestyles }
} .. frame:extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
|