Module:Sandbox/Erutuon: Difference between revisions

Content deleted Content added
functional now
invalid if language subtag is missing; increment count for private-use subtag
Line 367:
local parsed_subtags = { count = 0, invalid = false }
-- An array of patterns for each subtag, and a "type" field for the name
-- These patterns are checked in order. That is, the "language" subtag must
-- be beforeof the "script" subtag. However, any of the subtags can be skipped.
-- TheseThe patterns are checked in order., Thatand is,any of the "language"subtags subtagcan mustbe skipped.
-- That is, a tag may contain a "language" subtag, no "script" subtag and
-- thenSo, afor example, the "regionlanguage" subtag. must precede the "script"
-- That issubtag, but a tag may contain a "language" subtag, no "script" subtag and
-- If the full list of subtags has been iterated over, the
-- and then a "region" subtag.
-- If the full list of subtags has been iterated over, the remaining subtags
-- must match the pattern for a private-use subtag, or the tag is invalid.
local subtag_info = { -- can be put in data module
{ "%a%a%a?", "1%a+", type = "language" }, -- ll or lll; special case
Line 424 ⟶ 427:
parsed_subtags.private_use =
table.concat(subtags, "-", last_matched_subtag_i + 1)
parsed_subtags.count = parsed_subtags.count + 1
else
parsed_subtags.invalid = true
end
end
if not parsed_subtags.language then
parsed_subtags.invalid = true
end