Module:Citation/CS1/Identifiers/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1,528:
]]
 
local function build_id_list (id_list_tID_list_coins_t, options_t, access_levels_t)
local new_list_tID_list_t = {};
local accept;
local func_map = { --function map points to functions associated with hkey identifier
Line 1,560:
}
 
for hkey, v in pairs (id_list_tID_list_coins_t) do
v, accept = has_accept_as_written (v); -- remove accept-as-written markup if present; accept is boolean true when markup removed; false else
-- every function gets the options table with value v and accept boolean
Line 1,568:
options_t.access = access_levels_t[hkey]; -- add the access level for those that have an |<identifier-access= parameter
options_t.handler = cfg.id_handlers[hkey];
options_t.coins_list_t = id_list_tID_list_coins_t; -- experimentpointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's coinsmetadata
if func_map[hkey] then
table.insert (new_list_tID_list_t, {hkey, func_map[hkey] (options_t)}); -- call the function and add the results to the output sequence table
 
-- TODO: also retrieve identifier validity status, OL A/M/W/X type and ASIN TLD info from the corresponding function call for improved metadata generation in COinS() in ~/COinS
 
else
error (cfg.messages['unknown_ID_key'] .. ' ' .. hkey); -- here when func_map doesn't have a function for hkey
Line 1,583 ⟶ 1,581:
end
 
table.sort (new_list_tID_list_t, comp); -- sequence table of tables sort
for k, v in ipairs (new_list_tID_list_t) do -- convert sequence table of tables to simple sequence table of strings
new_list_tID_list_t[k] = v[2];
end
return new_list_tID_list_t;
end
 
Line 1,604 ⟶ 1,602:
local ID_access_levels_t = extract_id_access_levels (args, ID_list_coins_t); -- get a table of identifier access levels
local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t); -- get a sequence table of rendered identifier strings
 
-- TODO: add code to retrieve identifier validity status, OL A/M/W/X type and ASIN TLD info from ID_list_t and add this to ID_list_coins_t for improved metadata generation in COinS() in ~/COinS
 
return ID_list_t, ID_list_coins_t; -- return the tables