Content deleted Content added
part one of my master plan to find all list styles |
part 2? of hiding templatestyles |
||
Line 415:
end
local function add_navbox_styles(hiding_templatestyles)
local frame = mw.getCurrentFrame()
-- This is a lambda so that it doesn't need the frame as a parameter
Line 442:
templatestyles ..
child_templatestyles ..
add_list_styles() ..
table.concat(hiding_templatestyles)
)
:done()
end
-- work around [[phab:T303378]]
-- for each arg: find all the templatestyles strip markers, insert them into a
-- table. then remove all templatestyles markers from the arg
local function find_hiding_templatestyles(args)
local gfind = string.gfind
local insert = table.insert
local gsub = string.gsub
local templatestyles_markers = {}
local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)'
for _, arg in ipairs(args) do
for marker in gfind(arg, strip_marker_pattern) do
insert(templatestyles_markers, marker)
end
arg = gsub(arg, strip_marker_pattern, '')
end
return templatestyles_markers
end
function p._navbox(navboxArgs)
args = navboxArgs
local hiding_templatestyles = find_hiding_templatestyles(args)
local listnums = {}
Line 471 ⟶ 491:
if border == cfg.keyword.border_none then
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
Line 497 ⟶ 517:
:wikitext('<div>')
else
res:node(add_navbox_styles(hiding_templatestyles))
local nav = res:tag('div')
:attr('role', 'navigation')
|