Modul:Detect singular: Unterschied zwischen den Versionen
fix gsub
(more than one asterisk in a row should only count for one) |
(fix gsub) |
||
Zeile 5: | Zeile 5: | ||
local function plainFind(s, sub) | local function plainFind(s, sub) | ||
return mw.ustring.find(s, sub, 1, true) | return mw.ustring.find(s, sub, 1, true) | ||
end | end | ||
Zeile 31: | Zeile 26: | ||
local hasAnd = mw.ustring.find(s,'%Aand%A') | local hasAnd = mw.ustring.find(s,'%Aand%A') | ||
local hasBreak = mw.ustring.find(s,'<%s*br') | local hasBreak = mw.ustring.find(s,'<%s*br') | ||
local hasBullets = checkBullets and mw.ustring.gsub(s,'*+') > 1 | local hasBullets = checkBullets and mw.ustring.gsub(s,'*+','') > 1 | ||
return not (hasComma or hasList or hasAnd or hasBreak or hasBullets) | return not (hasComma or hasList or hasAnd or hasBreak or hasBullets) | ||
end | end |