Module:Delink/sandbox: Difference between revisions

Content deleted Content added
missed some mw.ustring functions
a few tweaks
Line 42:
 
function p._delinkWikilink(s)
-- s should beis a string starting with '[[' and ending with ']]'. It shoulddoes not contain any other ']]' strings.
 
-- Deal with nested links
local nested = '[[' .. s:sub(3):gsub('%[%[.-%]%]$', p._delinkWikilink)
if nested ~= s then
return nested
Line 60:
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local titlearea, display = decoded:match('^%[%[([^|%]]*)|?(.*)%]%]$')
local temptitlearea, fragment = titlearea:match('^(.-)#(.*)$')
titlearea = temptitlearea or titlearea
 
-- Check for bad characters.
Line 71 ⟶ 73:
local ns = mw.site.namespaces[colonprefix] -- see if this is a known namespace
if mw.language.isKnownLanguageTag(colonprefix)
or (ns and (ns.id == 6 or ns.id == 14))
then
return ''