Modul:Detect singular: Unterschied zwischen den Versionen

(change comma logic)
(count the number of list elements)
Zeile 29: Zeile 29:
end
end
local hasComma = checkComma and mw.ustring.find(s, '%a,%s')  
local hasComma = checkComma and mw.ustring.find(s, '%a,%s')  
local hasList = plainFind(s,'hlist') or mw.ustring.find(s,'<%s*li')
local hasMultipleListElements = countMatches(s,'<%s*li') > 1
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 countMatches(s,'%*+') > 1
local hasBullets = checkBullets and countMatches(s,'%*+') > 1
local multipleQids = mw.ustring.find(s,'Q%d+[%p%s]+Q%d+') -- has multiple QIDs in a row
local multipleQids = mw.ustring.find(s,'Q%d+[%p%s]+Q%d+') -- has multiple QIDs in a row
return not (hasComma or hasList or hasAnd or hasBreak or hasBullets or multipleQids)
return not (hasComma or hasMultipleListElements or hasAnd or hasBreak or hasBullets or multipleQids)
end
end