Content deleted Content added
m rv newline |
No edit summary |
||
Line 54:
local regex = orphanCat:gsub('([%[%]])', '%%%1')
return (wikitext:gsub(regex, ''):gsub(REGEX_MARKER, changer)) -- () omits gsub count
end
local function colorlinks(v, s)
if v and v ~= '' and s and s ~= '' then
if not mw.ustring.match(v, '<span style') then
v = mw.ustring.gsub(v, '%[%[([^%[%]|]*)%]%]',
'[[%1|<span style="' .. s .. '>%1</span>]]')
v = mw.ustring.gsub(v, '%[%[([^%[%]|]*)|([^%[%]|]*)%]%]',
'[[%1|<span style="' .. s .. '>%2</span>]]')
end
end
return v
end
local function extractstyle(v)
local r = ''
local slist = mw.text.split(mw.ustring.gsub(mw.ustring.gsub(v or '', '&#[Xx]23;', '#'), '#', '#'), ';')
for k = 1,#slist do
local s = slist[k]
if s:match('^[%s]*background') or s:match('^[%s]*color') then
r = r .. s .. ';'
end
end
return r
end
Line 132 ⟶ 156:
renderNavBar(titleCell)
if (args.stylelinks or '') == 'yes' then
args.title = colorlinks(args.title, extractstyle((args.basestyle or '') .. ';' .. (args.titlestyle or '')))
end
titleCell
:tag('div')
Line 156 ⟶ 184:
if not args.above then return end
if (args.stylelinks or '') == 'yes' then
args.above = colorlinks(args.above, extractstyle((args.basestyle or '') .. ';' .. (args.abovestyle or '')))
end
tbl:tag('tr')
:tag('td')
Line 172 ⟶ 204:
if not args.below then return end
if (args.stylelinks or '') == 'yes' then
args.below = colorlinks(args.below, extractstyle((args.basestyle or '') .. ';' .. (args.belowstyle or '')))
end
tbl:tag('tr')
:tag('td')
Line 209 ⟶ 245:
groupCell
:attr('id', mw.uri.anchorEncode(args.group1))
end
if (args.stylelinks or '') == 'yes' then
args['group' .. listnum] = colorlinks(args['group' .. listnum], extractstyle((args.basestyle or '') .. ';' .. (args.groupstyle or '') .. ';' .. (args['group' .. listnum .. 'style'] or '')))
end
|