Content deleted Content added
No edit summary |
No edit summary |
||
Line 5:
--[=[------------------------< G E T _ L A N G _ S C R I P T _ R E G I O N _ P A R T S >-----------------------
We get an
%%\n
Type: language\n
Line 22:
than one Description line and Description lines can wrap to the next line. When they do, the first two
characters of the continuation line are spaces.
Comments: lines can also be continued so once in a Comments line (which is otherwise ignored) all further
continuations in the record are also ignored. This is a crude mechanism to prevent comment continuations
from being concatenated onto the end of descriptions and relies on Description line occuring in the record
before the Comments line.
Records with Deprecated dates or Preferred-Value codes are ignored as are private use codes.
]=]
local function get_lang_script_region_parts (
local code;
local descriptions = {};
local in_comments = false;
return 'skip';
end
for line in mw.ustring.gmatch (record, '([^\n]+)\n') do -- get a \n terminate line of text (without the \n)
if mw.ustring.match (line, 'Subtag: [%a%d]+') then -- if this line is the subtag line
code = mw.ustring.match (line, 'Subtag: ([%a%d]+)'); -- extract and save to subtag's code
Line 72 ⟶ 83:
file_date = content:match ('(File%-Date: %d%d%d%d%-%d%d%-%d%d)'); -- get the file date line from this version of the source file
for
if mw.ustring.find (
code, descriptions = get_lang_script_region_parts (
if code and ('skip' ~= code) then
table.insert (lang_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
elseif not code then
table.insert (lang_table, "[\"error\"] = {" .. record .. "}");
end
elseif mw.ustring.find (
code, descriptions = get_lang_script_region_parts (
if code and ('skip' ~= code) then
table.insert (script_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
elseif not code then
table.insert (lang_table, "[\"error\"] = {" .. record .. "}");
end
elseif mw.ustring.find (
code, descriptions = get_lang_script_region_parts (
if code and ('skip' ~= code) then
table.insert (region_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
elseif not code then
table.insert (lang_table, "[\"error\"] = {" .. record .. "}");
end
end
|