Module:Cite/config

From Zoophilia Wiki
Jump to navigationJump to search

Documentation for this module may be created at Module:Cite/config/doc

-- TODO: In the future, use this to replace current <known_templates_t> and
-- <citation_classes_t>.
-- local cfg = mw.loadData("Module:Citation/CS1/Configuration")

--[[--------------------------< S E T T I N G S >-------------------------------
  Settings definitions for i18n; translate only the rvalues.
]]
local settings_t = {
  -- Name of the category that lists article with Module:Cite errors.
  err_category = "CS1 errors: Cite module",
  -- Help link display text for error messages.
  help = "help",
  -- Help text for error messages can be found on this page.
  help_text_link = "wikipedia:Help:CS1 errors##invoke:Cite_errors",
  -- Error message; $1 is lowercase value extracted from invoke function name.
  unknown_name = "Unknown template name: $1"
}

--[[--------------------< K N O W N _ T E M P L A T E S _ T >-------------------
  List of all known Cs1|2 templates by their lowercase names; key is lowercase
  template name.

  TODO: In the future, use this to replace current <known_templates_t> and
        <citation_classes_t>
    -- List of all known Cs1|2 template names, lowercased.
    local known_templates_t = {}
    -- List of all known Cs1|2 CitationClasses; key is lowercased template name.
    local citation_classes_t = {}

    for k, v in pairs(cfg.citation_class_map_t) do
      -- Remove 'Cite ' prefix and set template name to lowercase.
      local template = v:gsub("cite ", ""):lower()
      known_templates_t[template] = true  -- Add as a known template.
      citation_classes_t[template] = k    -- Add to list of citation classes.
    end
]]
local known_templates_t = {
  ["arxiv"]          = true,
  ["av media"]       = true,
  ["av media notes"] = true,
  ["biorxiv"]        = true,
  ["book"]           = true,
  ["citation"]       = true,
  ["citeseerx"]      = true,
  ["conference"]     = true,
  ["document"]       = true,
  ["encyclopedia"]   = true,
  ["episode"]        = true,
  ["interview"]      = true,
  ["journal"]        = true,
  ["magazine"]       = true,
  ["mailing list"]   = true,
  ["map"]            = true,
  ["medrxiv"]        = true,
  ["news"]           = true,
  ["newsgroup"]      = true,
  ["podcast"]        = true,
  ["press release"]  = true,
  ["report"]         = true,
  ["serial"]         = true,
  ["sign"]           = true,
  ["speech"]         = true,
  ["ssrn"]           = true,
  ["tech report"]    = true,
  ["thesis"]         = true,
  ["web"]            = true
}

--[[-------------------< C I T A T I O N _ C L A S S E S _ T >------------------
  |CitationClass= in the Cs1|2 templates gets the lowercase template name except
  for these, for which the canonical template name has multiple words (and the
  oddity that is class="encyclopaedia" – we really ought to fix that in
  Module:Citation/CS1); key is lowercase canonical template name.
]]
local citation_classes_t = {
  ["av media"]       = "audio-visual",
  ["av media notes"] = "AV-media-notes",
  ["encyclopedia"]   = "encyclopaedia",
  ["mailing list"]   = "mailinglist",
  ["press release"]  = "pressrelease",
  ["tech report"]    = "techreport"
}

--[[--------------------------< E X P O R T S >-------------------------------]]
return {
  citation_classes_t = citation_classes_t,
  error_messages_t   = error_messages_t,
  known_templates_t  = known_templates_t,
  settings_t         = settings_t
}