Modul:Vorlage:Anker: Unterschied zwischen den Versionen
2019-12-23
K (Schützte „Modul:Vorlage:Anker“: Durchführung der Bitte auf Adminanfrage ([Bearbeiten=Nur Sichter] (unbeschränkt) [Verschieben=Nur Administratoren] (unbeschränkt))) |
(2019-12-23) |
||
Zeile 1: | Zeile 1: | ||
local Anchor = { suite = "AnchorTemplate", | local Anchor = { suite = "AnchorTemplate", | ||
serial = "2019-12- | serial = "2019-12-23", | ||
item = 79414611 | item = 79414611 | ||
} | } | ||
Zeile 11: | Zeile 11: | ||
local Config = { | local Config = { | ||
badPattern = "[%%# | badPattern = "[%%#'\"%[%]<>]", | ||
globalPage = { "bodyContent", | globalPage = { "bodyContent", | ||
"catlinks", | "catlinks", | ||
Zeile 27: | Zeile 27: | ||
"siteSub", | "siteSub", | ||
"top" }, | "top" }, | ||
globalPatterns = { "^mw%-", | globalPatterns = { "^mw%-[%l%-]+$", | ||
"^ca%-", | "^ca%-[%l%-]+$", | ||
"^n%-", | "^n%-[%l%-]+$", | ||
"^pt?%-", | "^pt?%-[%l%-]+$", | ||
"^wp%u" }, | "^wp%u" }, | ||
errCat = false, | errCat = false, | ||
Zeile 192: | Zeile 192: | ||
Config.errHide = faculty( argsF.errHide ) | Config.errHide = faculty( argsF.errHide ) | ||
Config.errNS = argsF.errNS | Config.errNS = argsF.errNS | ||
if mw.site.server:find( "de.wikipedia.org", 1, true ) then | |||
Config.errNS = 0 | |||
Config.errClasses = "Linkwartung" | |||
end | |||
end | end | ||
if type( argsT ) == "table" then | if type( argsT ) == "table" then | ||
Zeile 197: | Zeile 201: | ||
local tocheck = { } | local tocheck = { } | ||
local further = function ( add ) | local further = function ( add ) | ||
local | local s = mw.text.unstripNoWiki( add ) | ||
s = s:gsub( " +", "_" ) | |||
table.insert( checked, | :gsub( "_+", "_" ) | ||
table.insert( checked, s ) | |||
end | end | ||
local s, unknown | local s, unknown | ||
Zeile 249: | Zeile 254: | ||
s = tocheck[ i ] | s = tocheck[ i ] | ||
if s:match( "^%d" ) or | if s:match( "^%d" ) or | ||
s:match( Config.badPattern ) then | s:match( Config.badPattern ) or | ||
s:match( "&#%a+;" ) then | |||
legal = false | legal = false | ||
else | else | ||
Zeile 354: | Zeile 360: | ||
end -- p.f() | end -- p.f() | ||
p.flops = function ( frame ) | |||
local r = "" | |||
local sep = "" | |||
local e | |||
for k = 1, #Config.globalPage do | |||
e = mw.html.create( "code" ) | |||
:wikitext( Config.globalPage[ k ] ) | |||
r = string.format( "%s%s%s", r, sep, tostring( e ) ) | |||
sep = ", " | |||
end -- k = 1, #Config.globalPage | |||
return r | |||
end -- p.flops() | |||
p.failsafe = function ( frame ) | p.failsafe = function ( frame ) | ||
Zeile 373: | Zeile 390: | ||
return Failsafe.failsafe( since ) or "" | return Failsafe.failsafe( since ) or "" | ||
end -- p.failsafe() | end -- p.failsafe() | ||
return p | return p |