Administrators, upwizcampeditors
0
edits
Chalochatu (talk | contribs) (Created page with " local coins = {}; --[[--------------------------< F O R W A R D D E C L A R A T I O N S >-------------------------------------- ]] local is_set, in_array, remove_wiki_li...") |
m (1 revision imported) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >-------------------------------------- | --[[--------------------------< F O R W A R D D E C L A R A T I O N S >-------------------------------------- | ||
]] | ]] | ||
local is_set, in_array, remove_wiki_link; -- functions in Module:Citation/CS1/Utilities | local is_set, in_array, remove_wiki_link; -- functions in Module:Citation/CS1/Utilities | ||
Line 178: | Line 177: | ||
value = value:gsub (' ', ' '); -- replace entity with plain space | value = value:gsub (' ', ' '); -- replace entity with plain space | ||
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space | value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space | ||
value = value:gsub ('‍', ''); -- remove ‍ entities | if not mw.ustring.find (value, cfg.indic_script) then -- don't remove zero width joiner characters from indic script | ||
value = value:gsub ('‍', ''); -- remove ‍ entities | |||
value = mw.ustring.gsub (value, '[\226\128\141\226\128\139\194\173]', ''); -- remove zero-width joiner, zero-width space, soft hyphen | |||
end | |||
value = value:gsub ('[\009\010\013]', ' '); -- replace horizontal tab, line feed, carriage return with plain space | value = value:gsub ('[\009\010\013]', ' '); -- replace horizontal tab, line feed, carriage return with plain space | ||
return value; | return value; | ||
Line 213: | Line 214: | ||
}); | }); | ||
if in_array (class, {'arxiv', 'journal', 'news'}) or (in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or | if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'journal', 'news', 'magazine'}) or (in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or | ||
('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then | ('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then | ||
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier | OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier | ||
if 'arxiv' | if in_array (class, {'arxiv', 'biorxiv', 'citeseerx'}) then -- set genre according to the type of citation template we are rendering | ||
OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv | OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv, cite biorxiv, cite citeseerx | ||
elseif 'conference' == class then | elseif 'conference' == class then | ||
OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set) | OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set) | ||
Line 320: | Line 321: | ||
-- sort with version string always first, and combine. | -- sort with version string always first, and combine. | ||
table.sort( OCinSoutput ); | --table.sort( OCinSoutput ); | ||
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004" | table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004" | ||
return table.concat(OCinSoutput, "&"); | return table.concat(OCinSoutput, "&"); |