Content deleted Content added
No edit summary |
m find function may be faster in if-statements |
||
Line 41:
local in_comments = false;
if mw.ustring.
return 'skip';
end
for line in mw.ustring.gmatch (record, '([^\n]+)\n') do -- get a \n terminated line of text (without the \n)
if mw.ustring.
code = mw.ustring.match (line, 'Subtag: ([%a%d]+)'); -- extract and save to subtag's code
elseif mw.ustring.
local desc = mw.ustring.match (line, 'Description: (.+)'); -- extract the description
desc = mw.ustring.gsub (desc, '"', '\\"'); -- in case description contains quote marks (see 1959acad)
table.insert (descriptions, '\"' .. desc .. '\"'); -- save the description wrapped in quote marks
elseif mw.ustring.
table.insert (prefixes, '\"' .. mw.ustring.match (line, 'Prefix: (.+)') .. '\"'); -- extract and save the prefix wrapped in quote marks
elseif mw.ustring.
in_comments = true;
elseif mw.ustring.
descriptions[#descriptions] = mw.ustring.gsub (descriptions[#descriptions], '\"$', ''); -- remove trailing quote mark from previous description
descriptions[#descriptions] = descriptions[#descriptions] .. ' ' .. mw.ustring.match (line, '^ (.+)') .. '\"'; -- extract and save the continuation with new quote mark
Line 100:
local in_comments = false;
if mw.ustring.
return 'skip';
end
for line in mw.ustring.gmatch (record, '([^\n]+)\n') do -- get a \n terminated line of text (without the \n)
if mw.ustring.
code = mw.ustring.match (line, 'Subtag: ([%a%d]+)'); -- extract and save to subtag's code
elseif mw.ustring.
table.insert (descriptions, '\"' .. mw.ustring.match (line, 'Description: (.+)') .. '\"'); -- extract and save the name wrapped in quote marks
elseif mw.ustring.
in_comments = true;
elseif mw.ustring.
descriptions[#descriptions] = mw.ustring.gsub (descriptions[#descriptions], '\"$', ''); -- remove trailing quote mark from previous description
descriptions[#descriptions] = descriptions[#descriptions] .. ' ' .. mw.ustring.match (line, '^ (.+)') .. '\"'; -- extract and save the continuation with new quote mark
|