Module:Citation/CS1/Configuration: Difference between revisions

    m (biorxiv fix;)
    (sync from sandbox;)
    Line 221: Line 221:
    ['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
    ['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
    ['Agency'] = 'agency',
    ['Agency'] = 'agency',
    -- ['AirDate'] = {'air-date', 'airdate'},
    ['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
    ['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
    ['ArchiveFormat'] = 'archive-format',
    ['ArchiveFormat'] = 'archive-format',
    Line 239: Line 238:
    ['ConferenceFormat'] = {'conference-format', 'event-format'},
    ['ConferenceFormat'] = {'conference-format', 'event-format'},
    ['ConferenceURL'] = {'conference-url', 'conferenceurl', 'event-url', 'eventurl'}, -- Used by InternetArchiveBot
    ['ConferenceURL'] = {'conference-url', 'conferenceurl', 'event-url', 'eventurl'}, -- Used by InternetArchiveBot
    ['Contribution'] = 'contribution', -- introduction, foreword, afterword, etc; required when |contributor= set; TODO: make internal only see TODO in main module
    -- ['Date'] = 'date',
    ['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
    ['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
    ['Degree'] = 'degree',
    ['Degree'] = 'degree',
    Line 254: Line 251:
    ['Editors'] = 'editors',
    ['Editors'] = 'editors',
    ['Embargo'] = 'embargo',
    ['Embargo'] = 'embargo',
    ['Encyclopedia'] = {'encyclopedia', 'encyclopaedia'}, -- this one only used by citation
    ['Encyclopedia'] = {'encyclopedia', 'encyclopaedia', 'dictionary'}, -- cite encyclopedia only
    ['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
    ['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
    ['Format'] = 'format',
    ['Format'] = 'format',
    Line 272: Line 269:
    ['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
    ['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
    ['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
    ['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
    -- ['MessageID'] = 'message-id',
    ['Minutes'] = 'minutes',
    ['Minutes'] = 'minutes',
    ['Mode'] = 'mode',
    ['Mode'] = 'mode',
    Line 285: Line 281:
    ['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
    ['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
    ['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
    ['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
    ['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work',
    ['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
    'encyclopedia', 'encyclopaedia', 'dictionary', 'mailinglist'}, -- these masquerade as periodicals but aren't TODO: find a better way to handle these?
    ['Place'] = {'place', 'location'},
    ['Place'] = {'place', 'location'},
    ['PostScript'] = 'postscript',
    ['PostScript'] = 'postscript',
    ['PublicationDate'] = {'publication-date', 'publicationdate'},
    ['PublicationDate'] = {'publication-date', 'publicationdate'},
    ['PublicationPlace'] = {'publication-place', 'publicationplace'},
    ['PublicationPlace'] = {'publication-place', 'publicationplace'},
    -- ['PublisherName'] = {'publisher', 'institution', 'newsgroup'},
    ['PublisherName'] = {'publisher', 'institution'},
    ['PublisherName'] = {'publisher', 'institution'},
    ['Quote'] = {'quote', 'quotation'},
    ['Quote'] = {'quote', 'quotation'},
    Line 300: Line 294:
    ['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-website', 'script-work'},
    ['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-website', 'script-work'},
    ['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
    ['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
    ['Section'] = 'section',
    ['Season'] = 'season',
    ['Season'] = 'season',
    ['Sections'] = 'sections', -- cite map only
    ['Sections'] = 'sections', -- cite map only
    Line 369: Line 362:
    local meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
    local meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
    'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
    'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
    'PostScript', 'Quote', 'Ref', -- miscellaneous
    'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask', -- name-list mask may have name separators
    'PostScript', 'Quote', 'Ref', -- miscellaneous
    'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'LayURL', 'MapURL', 'TranscriptURL', 'URL', -- url-holding parameters
    'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'LayURL', 'MapURL', 'TranscriptURL', 'URL', -- url-holding parameters
    }
    }
    Line 380: Line 374:
    for _, param in ipairs (params) do -- get the parameter name
    for _, param in ipairs (params) do -- get the parameter name
    punct_skip[param] = 1; -- add the parameter name to the skip table
    punct_skip[param] = 1; -- add the parameter name to the skip table
    local count;
    param, count = param:gsub ('#', ''); -- remove enumerator marker from enumerated parameters
    if 0 ~= count then -- if removed
    punct_skip[param] = 1; -- add param name without enumerator marker
    end
    end
    end
    end
    end
    Line 423: Line 422:
    function date_name_xlate() is used.
    function date_name_xlate() is used.


    In these tables, season numbering is defined by ISO DIS 8601:2016 part 2 §4.7 'Divisions of a year'.  The standard
    In these tables, season numbering is defined by Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
    defines various divisions using numbers 21-41.  cs1|2 only supports generic seasons.  ISO DIS 8601:2016 does support
    which became part of ISO 8601 in 2019. See '§Sub-year groupings'.  The standard defines various divisions using
    the distinction between north and south hemispere seasons but cs1|2 has no way to make that distinction.
    numbers 21-41.  cs1|2 only supports generic seasons.  EDTF does support the distinction between north and south
    hemispere seasons but cs1|2 has no way to make that distinction.


    The standard does not address 'named' dates so, for the purposes of cs1|2, Christmas is defined here as 99, which
    33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
    should be out of the ISO DIS 8601:2016 range of uses for a while.
     
    The standard does not address 'named' dates so, for the purposes of cs1|2, Easter and Christmas are defined here as 98 and 99, which
    should be out of the ISO 8601 (EDTF) range of uses for a while.


    ]]
    ]]
    Line 436: Line 438:
    ['long'] = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12},
    ['long'] = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12},
    ['short'] = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12},
    ['short'] = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12},
    ['quarter'] = {['First Quarter']=33, ['Second Quarter']=34, ['Third Quarter']=35, ['Fourth Quarter']=36},
    ['season'] = {['Winter']=24, ['Spring']=21, ['Summer']=22, ['Fall']=23, ['Autumn']=23},
    ['season'] = {['Winter']=24, ['Spring']=21, ['Summer']=22, ['Fall']=23, ['Autumn']=23},
    ['named'] = {['Christmas']=99},
    ['named'] = {['Easter']=98, ['Christmas']=99},
    },
    },
    ['local'] = { -- replace these English date names with the local language equivalents
    ['local'] = { -- replace these English date names with the local language equivalents
    ['long'] = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12},
    ['long'] = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12},
    ['short'] = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12},
    ['short'] = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12},
    ['quarter'] = {['First Quarter']=33, ['Second Quarter']=34, ['Third Quarter']=35, ['Fourth Quarter']=36},
    ['season'] = {['Winter']=24, ['Spring']=21, ['Summer']=22, ['Fall']=23, ['Autumn']=23},
    ['season'] = {['Winter']=24, ['Spring']=21, ['Summer']=22, ['Fall']=23, ['Autumn']=23},
    ['named'] = {['Christmas']=99},
    ['named'] = {['Easter']=98, ['Christmas']=99},
    },
    },
    ['inv_local_l'] = {}, -- used in date reformatting; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc
    ['inv_local_l'] = {}, -- used in date reformatting; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc
    Line 723: Line 727:
    --[[--------------------------< S C R I P T _ L A N G _ C O D E S >--------------------------------------------
    --[[--------------------------< S C R I P T _ L A N G _ C O D E S >--------------------------------------------


    This table is used to hold ISO 639-1 two-character language codes that apply only to |script-title= and |script-chapter=
    This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character language codes that apply only
    to |script-title= and |script-chapter=


    ]]
    ]]


    local script_lang_codes = {
    local script_lang_codes = {
    'am', 'ar', 'be', 'bg', 'bn', 'bo', 'bs', 'dv', 'dz', 'el', 'fa', -- ISO 639-1 codes only for |script-title= and |script-chapter=
    'am', 'ar', 'be', 'bg', 'bn', 'bo', 'bs', 'dv', 'dz', 'el', 'fa',
    'gu', 'he', 'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ku',
    'gu', 'he', 'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ku',
    'mk', 'ml', 'mn', 'mr', 'my', 'ne', 'ota', 'ps', 'ru', 'sd', 'si',
    'lo', 'mk', 'ml', 'mn', 'mr', 'my', 'ne', 'or', 'ota', 'ps', 'ru',
    'sr', 'ta', 'tg', 'th', 'ug', 'uk', 'ur', 'uz', 'yi', 'zh'
    'sd', 'si', 'sr', 'ta', 'tg', 'th', 'ug', 'uk', 'ur', 'uz', 'yi', 'zh'
    };
    };


    Line 941: Line 946:
    message = '<code class="cs1-code">&#124;arxiv=</code> required',
    message = '<code class="cs1-code">&#124;arxiv=</code> required',
    anchor = 'arxiv_missing',
    anchor = 'arxiv_missing',
    category = 'CS1 errors: arXiv', -- same as bad arxiv
    hidden = false
    },
    arxiv_params_not_supported = {
    message = 'Unsupported parameter(s) in cite arXiv',
    anchor = 'arxiv_params_not_supported',
    category = 'CS1 errors: arXiv', -- same as bad arxiv
    category = 'CS1 errors: arXiv', -- same as bad arxiv
    hidden = false
    hidden = false
    Line 1,269: Line 1,268:
    },
    },
    trans_missing_title = {
    trans_missing_title = {
    message = '<code class="cs1-code">&#124;trans-$1=</code> requires <code class="cs1-code">&#124;$1=</code>', -- $1 is base parameter name
    message = '<code class="cs1-code">&#124;trans-$1=</code> requires <code class="cs1-code">&#124;$1=</code> or  <code class="cs1-code">&#124;script-$1=</code>', -- $1 is base parameter name
    anchor = 'trans_missing_title',
    anchor = 'trans_missing_title',
    category = 'CS1 errors: translated title',
    category = 'CS1 errors: translated title',
    Line 1,286: Line 1,285:
    hidden = false
    hidden = false
    },
    },
    }
    --[[--------------------------< I D _ L I M I T S >------------------------------------------------------------
    certain identifiers have limits set upon their values so that typographic errors may be detected.  These (max)
    limits are defined here so that those limits may be automatically included in the template documentation and error
    message help text.
    ]]
    local id_limits = {
    pmc = 7500000, -- |pmc=
    pmid = 33000000, -- |pmid=
    ssrn = 4000000, -- |ssrn=
    s2cid = 230000000, -- |s2cid=
    }
    }


    Line 1,328: Line 1,311:
    set to nil to leave the identifier out of the COinS
    set to nil to leave the identifier out of the COinS
    separator: character or text between label and the identifier in the rendered citation
    separator: character or text between label and the identifier in the rendered citation
    id_limit: for those identifiers with established limits, this property holds the upper limit
    access: use this parameter to set the access level for all instances of this identifier.
    access: use this parameter to set the access level for all instances of this identifier.
    the value must be a valid access level for an identifier (see ['id-access'] in this file).
    the value must be a valid access level for an identifier (see ['id-access'] in this file).
    Line 1,570: Line 1,554:
    encode = true,
    encode = true,
    separator = '&nbsp;',
    separator = '&nbsp;',
    id_limit = 7500000,
    access = 'free', -- free to read
    access = 'free', -- free to read
    },
    },
    Line 1,583: Line 1,568:
    encode = false,
    encode = false,
    separator = '&nbsp;',
    separator = '&nbsp;',
    id_limit = 33000000,
    },
    },
    ['RFC'] = {
    ['RFC'] = {
    Line 1,618: Line 1,604:
    encode = true,
    encode = true,
    separator = '&nbsp;',
    separator = '&nbsp;',
    id_limit = 4000000,
    access = 'free', -- always free to read
    access = 'free', -- always free to read
    },
    },
    Line 1,631: Line 1,618:
    encode = false,
    encode = false,
    separator = '&nbsp;',
    separator = '&nbsp;',
    id_limit = 230000000,
    custom_access = 's2cid-access',
    custom_access = 's2cid-access',
    },
    },
    Line 1,675: Line 1,663:
    global_df = global_df,
    global_df = global_df,
    id_handlers = id_handlers,
    id_handlers = id_handlers,
    id_limits = id_limits,
    keywords_lists = keywords_lists,
    keywords_lists = keywords_lists,
    keywords_xlate = keywords_xlate,
    keywords_xlate = keywords_xlate,