Module:Sandbox/Erutuon: Difference between revisions

Content deleted Content added
"error" field
place invalid tag suffix in "invalid" field, use "error" to indicate both that an error was present and the type of error
Line 362:
-- This contains the special fields "matched_count" and "invalid".
-- "matched_count" tracks the number of subtags, "invaliderror" indicates thatwhy at leastthe
-- tag is invalid (if applicable).
-- one unparsable subtag was found. "error" indicates why the tag was
-- All other fields are subtags., and they appear in the tag in the following
-- invalid.
-- order:
-- All other fields are subtags.
-- "language", "script", "region", "variant", "private_use", "invalid"
local parsed_subtags = { matched_count = 0, invalid = false }
-- "invalid" is the portion of the tag after the last valid subtag (minus a
-- invalidhyphen).
local parsed_subtags = { matched_count = 0, invalid = false }
-- An array of patterns for each subtag, and a "type" field for the name
Line 425 ⟶ 428:
-- private-use subtag if it starts with "x". Otherwise, the tag is
-- invalid.
local suffix = table.concat(subtags, "-", last_matched_subtag_i + 1)
if subtags[last_matched_subtag_i + 1] == "x" then
parsed_subtags.private_use = suffix
table.concat(subtags, "-", last_matched_subtag_i + 1)
parsed_subtags.matched_count = parsed_subtags.matched_count + 1
else
parsed_subtags.invalid = truesuffix
parsed_subtags.error = "invalid subtag"
end
Line 436 ⟶ 439:
if not parsed_subtags.language then
parsed_subtags.invalid = true
parsed_subtags.error = "no language"
end