Module:Sandbox/Hellknowz/Test: Difference between revisions

Content deleted Content added
right
order
Line 254:
-- Dash with possible whitespace or Date separator (dash without whitespace)
-- Same but dash entity code and bothBoth non-breaking spaces - ' –- '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^(%s* [%-–—]%s* )', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
if (foundMatch == '-') then -- nothing else is date separator, no hyphens no stuff like that
return ELEMENT_DATESEPARATOR, foundMatch, (currentPosition > mw.ustring.len(seekString))
else
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString)) -- we will actually need to check for DATESEPARATOR as well, as that one stole the '-' case
end
end
-- Same but nonNon-breaking space - ' - '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^( [%-–—]%s*)', currentPosition)
if (foundPositionStart) then
Line 270 ⟶ 266:
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
end
-- SameDash butentity code and both non-breaking spaces - ' -– '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^( &[%-–—nm]dash; )', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
end
-- Same but dashDash entity code and non-breaking 'space - ' – '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^(%s* &[nm]dash;%s*)', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
end
-- Same but dashDash entity code and non-breaking space' - ' – '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^( %s*&[nm]dash;%s*)', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
end
-- Regular whitespace
-- Same but dash entity code and both non-breaking spaces - ' – '
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^( &%s*[nm%-–—]dash; %s*)', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString))
if (foundMatch == '-') then -- nothing else is date separator, no hyphens no stuff like that
return ELEMENT_DATESEPARATOR, foundMatch, (currentPosition > mw.ustring.len(seekString))
else
return ELEMENT_DASH, foundMatch, (currentPosition > mw.ustring.len(seekString)) -- we will actually need to check for DATESEPARATOR as well, as that one stole the '-' case
end
end