Content deleted Content added
+629-2 name extraction from the same data set; |
update links |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1:
require('
--[=[------------------------< I S O _ S Y N O N Y M _ E X T R A C T >-----------------------------------------
{{#invoke:
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts
Line 57:
--[[--------------------------< I S O _ 2 _ N A M E _ E X T R A C T >------------------------------------------
{{#invoke:
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts
Line 83:
local name_table = {}; -- holds language names for processing
local code_table = {}; -- because some languages have both -2B and -2T codes
local
local out_table_B = {}; -- output table for 639-2B codes
local out_table; -- used as a pointer to the selected out_table_B or out_table_T
local file_date = 'File-Date: ' .. frame.args["file-date"]; -- set the file date line from |file-date= (from the bottom of the source page)
Line 99 ⟶ 101:
code_table = mw.text.split (split_table[4], ' */ *'); -- split 'ISO 639-2' code at the '/' into a table of -2B and -2T individual codes
for
if not skip_table[code] then -- source data has duplicates so check to see if we have already done this code
out_table = (2 == #code_table and 1 == i) and out_table_B or out_table_T; -- does this language name have both -2B and -2T codes?
table.insert (out_table,
table.concat ({
Line 116 ⟶ 119:
end
table.sort (
table.sort (out_table_B);
return table.concat ({
"<br /><pre>-- ",
file_date,
"<br />return {",
string.rep ('	', 18),
'-- 639-2T<br />	',
table.concat (out_table_T, ',<br />	'),
"<br />	}<br />" .. "</pre><br /><br />",
"<br /><pre>-- ",
file_date,
"<br />return {",
string.rep ('	', 18),
'-- 639-2B<br />	',
table.concat (out_table_B, ',<br />	'),
"<br />	}<br />" .. "</pre><br /><br />",
});
end
|