Module:Sandbox/Hellknowz/Test: Difference between revisions

Content deleted Content added
debug again then
mw.ustring.len? but surely they didnt trigger that
Line 184:
-- Additionally check how many digits we actually have, as arbitrary number isn't valid
if (#foundMatch <= 2) then
return ELEMENT_ONETWODIGITS, tonumber(foundMatch), (currentPosition > #mw.ustring.len(seekString))
elseif (#foundMatch == 4) then
return ELEMENT_FOURDIGITS, tonumber(foundMatch), (currentPosition > #mw.ustring.len(seekString))
else
return ELEMENT_INVALID -- just the invalid, the number of digits won't match any pattern
Line 196:
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_TIMEPERIOD, foundMatch, (currentPosition > #mw.ustring.len(seekString))
end
 
Line 211:
 
if (monthIndex) then
return ELEMENT_MONTHWORD, monthIndex, (currentPosition > #mw.ustring.len(seekString))
else
return ELEMENT_INVALID -- just the invalid, the word didn't match a valid month name
Line 227:
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
Line 236:
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_DASH, foundMatch, (currentPosition > #mw.ustring.len(seekString))
end
-- Time separator (colon without whitespace)
foundPositionStart, foundPositionEnd, foundMatch = mw.ustring.find(seekString, '^(:)', currentPosition)
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_TIMESEPARATOR, foundMatch, (currentPosition > #mw.ustring.len(seekString))
end
 
Line 249 ⟶ 250:
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_COMMA, foundMatch, (currentPosition > #mw.ustring.len(seekString))
end
 
Line 256 ⟶ 257:
if (foundPositionStart) then
currentPosition = foundPositionEnd + 1 -- this is our new start ___location
return ELEMENT_WHITESPACE, foundMatch, (currentPosition > #mw.ustring.len(seekString))
end