----------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
local cfg; -- table of tables imported from slected Module:Citation/CS1/Configuration
local function _convert_year(val, local_digits) val = mw.ustring.gsub (val, '%d', local_digits); -- translate 'local' digits to Western 0-9 if val:match("^%d+$") then val = val-543; -- convert year to 4 digits to prevent it being interpreted as day in en module if val<0 then return false; -- TODO: handle this --elseif val<1 then -- val='000'..val; elseif val<10 then -- this should be faster than formatDate? val='000'..val; elseif val<100 then val='00'..val; elseif val<1000 then val='0'..val; end return val; end return false;end
local en_month_name = ;local function _convert_local_date(val, date_names_local, local_digits) local dmy = mw.text.split(val, '%s+'); if #dmy
2 then local dmy1 = date_names_local.long[dmy[1]] or date_names_local.short[dmy[1]]; if dmy1 then dmy[2] = _convert_year(dmy[2], local_digits); if dmy[2] then return en_month_name[dmy1]..' '..dmy[2]; end return val; end dmy[2] = date_names_local.long[dmy[2]] or date_names_local.short[dmy[2]]; if dmy[2] then dmy[1] = mw.ustring.gsub (dmy[1], '%d', local_digits); -- translate 'local' digits to Western 0-9 -- always interprete dmy[1] as day if dmy[1]:match("^%d%d?$") then dmy[1] = tonumber(dmy[1]); if dmy[1]>31 or dmy[1]<1 then return val; end return dmy[1]..' '..en_month_name[dmy[2]]; end return val; end return val; elseif #dmy
--Some local wiki use non-Gregorian calendar.Use this function to convert local non-Gregorian calendar to Gregorian calendar
local function convert_local_date(k, val) if 'year'
k or 'access-date'
k or 'doi-broken-date'
k or 'lay-date'
k then -- return _convert_local_date(val, cfg.date_names['local'], cfg.date_names.local_digits); --elseif 'embargo'
----------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local imported functions table to same (live or sandbox) as that used by the other modules.
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr) cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configurationend
----------------------------< E X P O R T S >----------------------------------------------------------------
return