Modul:TemplUtl: Unterschied zwischen den Versionen
2016-02-28
(2015-02-12) |
(2016-02-28) |
||
Zeile 1: | Zeile 1: | ||
local TemplUtl = { suite = "TemplUtl", | local TemplUtl = { suite = "TemplUtl", | ||
serial = " | serial = "2016-02-28" }; | ||
local Delimiters; | local Delimiters; | ||
Zeile 378: | Zeile 378: | ||
-- Returns cleared wikitext | -- Returns cleared wikitext | ||
local delimiters = { { "<%s*NOWIKI%s*>", "<%s*/%s*NOWIKI%s*>" }, | local delimiters = { { "<%s*NOWIKI%s*>", "<%s*/%s*NOWIKI%s*>" }, | ||
{ "<!--", "-->" }, | { "<!--", "-->", true }, | ||
{ "<%s*PRE%s*>", "<%s*/%s*PRE%s*>" }, | { "<%s*PRE%s*>", "<%s*/%s*PRE%s*>" }, | ||
{ "<%s*SYNTAXHIGHLIGHT[^<>]*>", | { "<%s*SYNTAXHIGHLIGHT[^<>]*>", | ||
Zeile 409: | Zeile 409: | ||
k = false; | k = false; | ||
for j = 1, #delimiters do | for j = 1, #delimiters do | ||
m = r:find( Delimiters[ j ][ 1 ], | m = r:find( Delimiters[ j ][ 1 ], | ||
if m and ( not k or m | i, | ||
Delimiters[ j ][ 3 ] ); | |||
if m and ( not k or m < k ) then | |||
k = m; | k = m; | ||
n = j; | n = j; | ||
Zeile 418: | Zeile 420: | ||
local s | local s | ||
if k > 1 then | if k > 1 then | ||
s = r:sub( 1, | i = k - 1; | ||
s = r:sub( 1, i ); | |||
else | else | ||
s = ""; | s = ""; | ||
end | end | ||
j, m = r:find( Delimiters[ n ][ 2 ], | j, m = r:find( Delimiters[ n ][ 2 ], | ||
k + 1, | |||
Delimiters[ n ][ 3 ] ); | |||
if m then | if m then | ||
r = s .. r:sub( m + 1 ); | r = s .. r:sub( m + 1 ); | ||
Zeile 440: | Zeile 445: | ||
-- Export | -- Export | ||
local p = { }; | local p = { }; | ||
function p.failsafe() | |||
return TemplUtl.serial | |||
end | |||
p.TemplUtl = function () | p.TemplUtl = function () |