Content deleted Content added
invalid if language subtag is missing; increment count for private-use subtag |
"error" field |
||
Line 361:
local subtags = mw.text.split(tag, "-")
-- This contains the special fields "
-- "
-- one unparsable subtag was found. "error" indicates why the tag was
-- invalid.
-- All other fields are subtags.
local parsed_subtags = {
-- An array of patterns for each subtag, and a "type" field for the name
Line 413 ⟶ 414:
parsed_subtags[type] = subtag
last_matched_subtag_i = subtag_i
parsed_subtags.
elseif not subtag_info[index] then
break
Line 419 ⟶ 420:
end
if #subtags > parsed_subtags.
-- Not all subtags were matched. The unmatched tail end of the tag
-- (after the subtag at the index last_matched_subtag_i) is a
Line 427 ⟶ 428:
parsed_subtags.private_use =
table.concat(subtags, "-", last_matched_subtag_i + 1)
parsed_subtags.
else
parsed_subtags.invalid = true
parsed_subtags.error = "invalid subtag"
end
end
Line 435 ⟶ 437:
if not parsed_subtags.language then
parsed_subtags.invalid = true
parsed_subtags.error = "no language"
end
|