Title: Module:Citation/CS1/Utilities - freem URL Source: https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities Markdown Content: [Jump to content](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#bodyContent) - [x] Main menu Main menu move to sidebar hide Navigation * [Main page](https://freemwiki.com/wiki/Main_Page "Visit the main page [alt-shift-z]") * [Recent changes](https://freemwiki.com/wiki/Special:RecentChanges "A list of recent changes in the wiki [alt-shift-r]") * [Random page](https://freemwiki.com/wiki/Special:Random "Load a random page [alt-shift-x]") * [Help about MediaWiki](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents) Legal * [Terms](https://freemwiki.com/wiki/Terms_of_Service) * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Contact](https://freemwiki.com/wiki/Contact) [![Image 1](https://freemwiki.com/images/freem.svg)**freem**](https://freemwiki.com/wiki/Main_Page) [Search](https://freemwiki.com/wiki/Special:Search "Search freem [alt-shift-f]") Search - [x] Appearance * [Create account](https://freemwiki.com/index.php?title=Special:CreateAccount&returnto=Module%3ACitation%2FCS1%2FUtilities&returntoquery=oldid%3D579714 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ACitation%2FCS1%2FUtilities&returntoquery=oldid%3D579714 "You are encouraged to log in; however, it is not mandatory [alt-shift-o]") - [x] Personal tools * [Create account](https://freemwiki.com/index.php?title=Special:CreateAccount&returnto=Module%3ACitation%2FCS1%2FUtilities&returntoquery=oldid%3D579714 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ACitation%2FCS1%2FUtilities&returntoquery=oldid%3D579714 "You are encouraged to log in; however, it is not mandatory [alt-shift-o]") Pages for logged out editors [learn more](https://freemwiki.com/wiki/Help:Introduction) * [Contributions](https://freemwiki.com/wiki/Special:MyContributions "A list of edits made from this IP address [alt-shift-y]") * [Talk](https://freemwiki.com/wiki/Special:MyTalk "Discussion about edits from this IP address [alt-shift-n]") # Module:Citation/CS1/Utilities - [x] 1 language * [English](https://freemwiki.com/wiki/Module:Citation/CS1/ "Module:Citation/CS1/ – English") * [Module](https://freemwiki.com/wiki/Module:Citation/CS1/Utilities "View the module page [alt-shift-c]") * [Discussion](https://freemwiki.com/index.php?title=Module_talk:Citation/CS1/Utilities&action=edit&redlink=1 "Discussion about the content page (page does not exist) [alt-shift-t]") - [x] English * [Read](https://freemwiki.com/wiki/Module:Citation/CS1/Utilities) * [Edit source](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&action=edit "Edit the source code of this page [alt-shift-e]") * [View history](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&action=history "Past revisions of this page [alt-shift-h]") - [x] Tools Tools move to sidebar hide Actions * [Read](https://freemwiki.com/wiki/Module:Citation/CS1/Utilities) * [Edit source](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&action=edit "Edit the source code of this page [alt-shift-e]") * [View history](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&action=history) General * [What links here](https://freemwiki.com/wiki/Special:WhatLinksHere/Module:Citation/CS1/Utilities "A list of all wiki pages that link here [alt-shift-j]") * [Related changes](https://freemwiki.com/wiki/Special:RecentChangesLinked/Module:Citation/CS1/Utilities "Recent changes in pages linked from this page [alt-shift-k]") * [Special pages](https://freemwiki.com/wiki/Special:SpecialPages "A list of all special pages [alt-shift-q]") * [Printable version](javascript:print(); "Printable version of this page [alt-shift-p]") * [Permanent link](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&oldid=579714 "Permanent link to this revision of this page") * [Page information](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&action=info "More information about this page") Appearance move to sidebar hide From freem <[Module:Citation/CS1](https://freemwiki.com/wiki/Module:Citation/CS1 "Module:Citation/CS1") Revision as of 06:18, 21 October 2025 by [Lukegao](https://freemwiki.com/index.php?title=User:Lukegao&action=edit&redlink=1 "User:Lukegao (page does not exist)")([talk](https://freemwiki.com/index.php?title=User_talk:Lukegao&action=edit&redlink=1 "User talk:Lukegao (page does not exist)") | [contribs](https://freemwiki.com/wiki/Special:Contributions/Lukegao "Special:Contributions/Lukegao"))(1 revision imported) ([diff](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&diff=prev&oldid=579714 "Module:Citation/CS1/Utilities")) [← Older revision](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&direction=prev&oldid=579714 "Module:Citation/CS1/Utilities") | Latest revision (diff) | Newer revision → (diff) _Documentation for this module may be created at [Module:Citation/CS1/Utilities/doc](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities/doc&action=edit&redlink=1 "Module:Citation/CS1/Utilities/doc (page does not exist)")_ [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-1)local z = {[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-2)error_cats_t = {};-- for categorizing citations that contain errors[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-3)error_ids_t = {};-- list of error identifiers; used to prevent duplication of certain errors; local to this module[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-4)error_msgs_t = {};-- sequence table of error messages[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-5)maint_cats_t = {};-- for categorizing citations that aren't erroneous per se, but could use a little work[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-6)prop_cats_t = {};-- for categorizing citations based on certain properties, language of source for instance[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-7)prop_keys_t = {};-- for adding classes to the citation's tag[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-8)};[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-9)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-10)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-11)--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-12)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-13)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-14)local cfg;-- table of tables imported from selected Module:Citation/CS1/Configuration[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-15)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-16)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-17)--[[--------------------------< I S _ S E T >------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-18)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-19)Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-20)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-21)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-22)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-23)local function is_set (var)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-24)return not (var == nil or var == '');[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-25)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-26)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-27)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-28)--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-29)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-30)Whether needle is in haystack[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-31)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-32)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-33)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-34)local function in_array (needle, haystack)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-35)if needle == nil then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-36)return false;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-37)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-38)for n, v in ipairs (haystack) do[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-39)if v == needle then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-40)return n;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-41)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-42)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-43)return false;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-44)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-45)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-46)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-47)--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-48)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-49)When is wholly wrapped in accept-as-written markup, return without markup and true; return and false else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-50)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-51)with allow_empty = false, must have at least one character inside the markup[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-52)with allow_empty = true, the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-53)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-54)After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-55)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-56)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-57)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-58)local function has_accept_as_written (str, allow_empty)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-59)if not is_set (str) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-60)return str, false;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-61)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-62)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-63)local count;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-64)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-65)if true == allow_empty then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-66)str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); -- allows (()) to be an empty set[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-67)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-68)str, count = str:gsub ('^%(%((.+)%)%)$', '%1');[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-69)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-70)return str, 0 ~= count;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-71)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-72)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-73)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-74)--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-75)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-76)Populates numbered arguments in a message string using an argument table. may be a single string or a[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-77)sequence table of multiple strings.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-78)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-79)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-80)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-81)local function substitute (msg, args)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-82)return args and mw.message.newRawMessage (msg, args):plain() or msg;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-83)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-84)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-85)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-86)--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-87)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-88)Wraps error messages with CSS markup according to the state of hidden. may be a single string or a[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-89)sequence table of multiple strings.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-90)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-91)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-92)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-93)local function error_comment (content, hidden)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-94)return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-95)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-96)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-97)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-98)--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-99)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-100)Converts a hyphen, endash, emdash to endash under certain conditions. The hyphen/en/em must separate[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-101)like items; unlike items are returned unmodified. These forms are modified:[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-102) letter - letter (A-B)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-103) digit - digit (4-5)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-104) digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-105) letterdigit - letterdigit (A1-A5) (an optional separator between letter and[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-106) digit is supported – a.1-a.5 or a-1-a-5)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-107) digitletter - digitletter (5a-5d) (an optional separator between letter and[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-108) digit is supported – 5.a-5.d or 5-a-5-d)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-109)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-110)any other forms are returned unmodified.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-111)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-112)str may be a comma- or semicolon-separated list of page ranges with/without single pages[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-113)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-114)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-115)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-116)local function hyphen_to_dash (str)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-117)if not is_set (str) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-118)return str;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-119)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-120)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-121)str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-122)str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'});-- replace — and – entities with their characters; semicolon mucks up the text.split[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-123)str = str:gsub ('-', '-');-- replace HTML numeric entity with hyphen character[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-124)str = str:gsub (' ', ' ');-- replace   entity with generic keyboard space character[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-125)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-126)local out = {};[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-127)local list = mw.text.split (str, '%s*[,;]%s*');-- split str at comma or semicolon separators if there are any[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-128)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-129)local accept;-- boolean[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-130)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-131)for _, item in ipairs (list) do-- for each item in the list[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-132)item, accept = has_accept_as_written (item);-- remove accept-this-as-written markup when it wraps all of item[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-133)if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[—–-]%s*%w*[%.%-]?%w+$') then-- if a hyphenated range or has endash or emdash separators[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-134)if mw.ustring.match (item, '^%a+[%.%-]?%d+%s*[—–-]%s*%a+[%.%-]?%d+$') or-- letterdigit hyphen letterdigit (optional separator between letter and digit)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-135)mw.ustring.match (item, '^%d+[%.%-]?%a+%s*[—–-]%s*%d+[%.%-]?%a+$') or-- digitletter hyphen digitletter (optional separator between digit and letter)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-136)mw.ustring.match (item, '^%d+[%.%-]%d+%s*[—–-]%s*%d+[%.%-]%d+$') then-- digit separator digit hyphen digit separator digit[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-137)item = mw.ustring.gsub (item, '(%w*[%.%-]?%w+)%s*[—–-]%s*(%w*[%.%-]?%w+)', '%1 – %2');-- replace hyphen/dash, with spaced endash[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-138)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-139)elseif mw.ustring.match (item, '^%d+%s*[—–-]%s*%d+$') or-- digit hyphen digit[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-140)mw.ustring.match (item, '^%a+%s*[—–-]%s*%a+$') then-- letter hyphen letter[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-141)item = mw.ustring.gsub (item, '(%w+)%s*[—–-]%s*(%w+)', '%1–%2');-- replace hyphen/emdash with endash, remove extraneous space characters[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-142)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-143)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-144)-- item = mw.ustring.gsub (item, '%s*[—–-]%s*', '–'); -- disabled; here when 'unlike' items so return as is[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-145)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-146)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-147)table.insert (out, item);-- add the (possibly modified) item to the output table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-148)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-149)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-150)local temp_str = '';-- concatenate the output table into a comma separated string[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-151)temp_str, accept = has_accept_as_written (table.concat (out, ', '));-- remove accept-this-as-written markup when it wraps all of concatenated out[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-152)if accept then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-153)temp_str = has_accept_as_written (str);-- when global markup removed, return original str; do it this way to suppress boolean second return value[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-154)return temp_str:gsub(",", ","):gsub(";", ";");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-155)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-156)return temp_str:gsub(",", ","):gsub(";", ";");-- else, return assembled temp_str[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-157)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-158)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-159)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-160)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-161)--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-162)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-163)Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[[L|D]]](https://freemwiki.com/wiki/L "L"); if only[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-164)link is provided (or link and display are the same), returns a wikilink in the form [[[L]]](https://freemwiki.com/wiki/L "L"); if neither are[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-165)provided or link is omitted, returns an empty string.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-166)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-167)]=][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-168)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-169)local function make_wikilink (link, display)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-170)if not is_set (link) then return '' end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-171)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-172)if is_set (display) and link ~= display then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-173)return table.concat ({'[[', link, '|', display, ']]'});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-174)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-175)return table.concat ({'[[', link, ']]'});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-176)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-177)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-178)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-179)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-180)--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-181)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-182)Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-183)call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-184)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-185) – key value for appropriate error handler in ~/Configuration error_conditions{} table [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-186) – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-187) – boolean[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-188) true – causes this function to return the error message not wrapped in visible-error, hidden-error span tag;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-189) returns error_conditions[error_id].hidden as a second return value[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-190) does not add message to z.error_msgs_t sequence table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-191) false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-192) returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-193) – string to be prepended to -- TODO: remove support for these unused(?) arguments?[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-194) – string to be appended to [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-195)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-196)TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true? this to avoid dups without having to have an extra table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-197)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-198)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-199)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-200)local added_maint_cats = {}-- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-201)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-202)local function set_message (error_id, arguments, raw, prefix, suffix)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-203)local error_state = cfg.error_conditions[error_id];[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-204)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-205)prefix = prefix or '';[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-206)suffix = suffix or '';[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-207)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-208)if error_state == nil then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-209)error (cfg.messages['undefined_error'] .. ': ' .. error_id);-- because missing error handler in Module:Citation/CS1/Configuration[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-210)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-211)elseif is_set (error_state.category) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-212)if error_state.message then-- when error_state.message defined, this is an error message[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-213)table.insert (z.error_cats_t, error_state.category);[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-214)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-215)if not added_maint_cats[error_id] then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-216)added_maint_cats[error_id] = true;-- note that we've added this category[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-217)table.insert (z.maint_cats_t, substitute (error_state.category, arguments));-- make cat name then add to table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-218)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-219)return;-- because no message, nothing more to do[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-220)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-221)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-222)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-223)local message = substitute (error_state.message, arguments);[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-224)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-225)message = table.concat ([](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-226){[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-227)message,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-228)' (',[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-229)make_wikilink ([](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-230)table.concat ([](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-231){[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-232)cfg.messages['help page link'],[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-233)'#',[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-234)error_state.anchor[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-235)}),[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-236)cfg.messages['help page label']),[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-237)')'[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-238)});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-239)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-240)z.error_ids_t[error_id] = true;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-241)if z.error_ids_t['err_citation_missing_title'] and-- if missing-title error already noted[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-242)in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then-- and this error is one of these[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-243)return '', false;-- don't bother because one flavor of missing title is sufficient[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-244)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-245)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-246)message = table.concat ({prefix, message, suffix});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-247)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-248)if true == raw then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-249)return message, error_state.hidden;-- return message not wrapped in visible-error, hidden-error span tag[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-250)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-251)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-252)message = error_comment (message, error_state.hidden);-- wrap message in visible-error, hidden-error span tag[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-253)table.insert (z.error_msgs_t, message);-- add it to the messages sequence table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-254)return message;-- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-255)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-256)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-257)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-258)--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-259)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-260)This function is used by select_one() to determine if one of a list of alias parameters is in the argument list[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-261)provided by the template.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-262)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-263)Input:[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-264) args – pointer to the arguments table from calling template[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-265) alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-266) index – for enumerated parameters, identifies which one[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-267) enumerated – true/false flag used to choose how enumerated aliases are examined[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-268) value – value associated with an alias that has previously been selected; nil if not yet selected[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-269) selected – the alias that has previously been selected; nil if not yet selected[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-270) error_list – list of aliases that are duplicates of the alias already selected[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-271)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-272)Returns:[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-273) value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-274) selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-275)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-276)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-277)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-278)local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-279)if enumerated then-- is this a test for an enumerated parameters?[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-280)alias = alias:gsub ('#', index);-- replace '#' with the value in index[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-281)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-282)alias = alias:gsub ('#', '');-- remove '#' if it exists[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-283)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-284)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-285)if is_set (args[alias]) then-- alias is in the template's argument list[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-286)if value ~= nil and selected ~= alias then-- if we have already selected one of the aliases[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-287)local skip;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-288)for _, v in ipairs (error_list) do-- spin through the error list to see if we've added this alias[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-289)if v == alias then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-290)skip = true;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-291)break;-- has been added so stop looking [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-292)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-293)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-294)if not skip then-- has not been added so[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-295)table.insert (error_list, alias);-- add error alias to the error list[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-296)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-297)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-298)value = args[alias];-- not yet selected an alias, so select this one[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-299)selected = alias;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-300)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-301)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-302)return value, selected;-- return newly selected alias, or previously selected alias[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-303)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-304)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-305)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-306)--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-307)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-308)Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-309)To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-310)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-311)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-312)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-313)local function add_maint_cat (key, arguments)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-314)if not added_maint_cats [key] then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-315)added_maint_cats [key] = true;-- note that we've added this category[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-316)table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments));-- make name then add to table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-317)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-318)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-319)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-320)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-321)--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-322)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-323)Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-324)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-325)foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-326)may be categorized but multiples of the same language are not categorized.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-327)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-328)added_prop_cats is a table declared in page scope variables above[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-329)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-330)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-331)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-332)local added_prop_cats = {};-- list of property categories that have been added to z.prop_cats_t[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-333)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-334)local function add_prop_cat (key, arguments, key_modifier)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-335)local key_modified = key .. ((key_modifier and key_modifier) or '');-- modify with if present and not nil[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-336)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-337)if not added_prop_cats [key_modified] then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-338)added_prop_cats [key_modified] = true;-- note that we've added this category[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-339)table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments));-- make name then add to table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-340)table.insert (z.prop_keys_t, 'cs1-prop-' .. key);-- convert key to class for use in the citation's tag[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-341)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-342)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-343)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-344)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-345)--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-346)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-347)Protects a string that will be wrapped in wiki italic markup '' ... ''[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-348)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-349)Note: We cannot use for italics, as the expected behavior for italics specified by ''...'' in the title is that[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-350)they will be inverted (i.e. unitalicized) in the resulting references. In addition, and '' tend to interact[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-351)poorly under Mediawiki's HTML tidy.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-352)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-353)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-354)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-355)local function safe_for_italics (str)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-356)if not is_set (str) then return str end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-357)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-358)if str:sub (1, 1) == "'" then str = "" .. str; end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-359)if str:sub (-1, -1) == "'" then str = str .. ""; end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-360)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-361)return str:gsub ('\n', ' ');-- Remove newlines as they break italics.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-362)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-363)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-364)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-365)--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-366)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-367)Applies styling to various parameters. Supplied string is wrapped using a message_list configuration taking one[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-368)argument; protects italic styled parameters. Additional text taken from citation_config.presentation - the reason[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-369)this function is similar to but separate from wrap_msg().[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-370)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-371)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-372)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-373)local function wrap_style (key, str)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-374)if not is_set (str) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-375)return "";[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-376)elseif in_array (key, {'italic-title', 'trans-italic-title'}) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-377)str = safe_for_italics (str);[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-378)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-379)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-380)return substitute (cfg.presentation[key], {str});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-381)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-382)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-383)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-384)--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-385)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-386)make a separated list of items using provided separators.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-387) - typically ''[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-388) - typically 'and'[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-389) - typically 'and' or '&'[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-390)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-391)defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end'][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-392)if is specified, and must also be supplied[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-393)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-394)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-395)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-396)local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-397)local list = '';[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-398)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-399)if not sep_list then-- set the defaults[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-400)sep_list = cfg.presentation['sep_list'];[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-401)sep_list_pair = cfg.presentation['sep_list_pair'];[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-402)sep_list_end = cfg.presentation['sep_list_end'];[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-403)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-404)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-405)if 2 >= count then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-406)list = table.concat (list_seq, sep_list_pair);-- insert separator between two items; returns list_seq[1] then only one item[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-407)elseif 2 < count then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-408)list = table.concat (list_seq, sep_list, 1, count - 1);-- concatenate all but last item with plain list separator[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-409)list = table.concat ({list, list_seq[count]}, sep_list_end);-- concatenate last item onto end of with final separator[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-410)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-411)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-412)return list;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-413)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-414)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-415)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-416)--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-417)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-418)Chooses one matching parameter from a list of parameters to consider. The list of parameters to consider is just[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-419)names. For parameters that may be enumerated, the position of the numerator in the parameter name is identified[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-420)by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-421)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-422)Because enumerated parameter |1= is an alias of |= we must test for both possibilities.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-423)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-424)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-425)Generates an error if more than one match is present.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-426)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-427)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-428)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-429)local function select_one (args, aliases_list, error_condition, index)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-430)local value = nil;-- the value assigned to the selected parameter[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-431)local selected = '';-- the name of the parameter we have chosen[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-432)local error_list = {};[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-433)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-434)if index ~= nil then index = tostring(index); end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-435)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-436)for _, alias in ipairs (aliases_list) do-- for each alias in the aliases list[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-437)if alias:match ('#') then-- if this alias can be enumerated[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-438)if '1' == index then-- when index is 1 test for enumerated and non-enumerated aliases[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-439)value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);-- first test for non-enumerated alias[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-440)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-441)value, selected = is_alias_used (args, alias, index, true, value, selected, error_list);-- test for enumerated alias[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-442)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-443)value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);-- test for non-enumerated alias[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-444)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-445)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-446)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-447)if #error_list > 0 and 'none' ~= error_condition then-- for cases where this code is used outside of extract_names()[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-448)for i, v in ipairs (error_list) do[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-449)error_list[i] = wrap_style ('parameter', v);[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-450)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-451)table.insert (error_list, wrap_style ('parameter', selected));[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-452)set_message (error_condition, {make_sep_list (#error_list, error_list)});[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-453)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-454)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-455)return value, selected;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-456)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-457)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-458)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-459)--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-460)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-461)Gets the display text from a wikilink like [[[A|B]]](https://freemwiki.com/wiki/A "A") or [[[B]]](https://freemwiki.com/wiki/B "B") gives B[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-462)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-463)The str:gsub() returns either A|B froma [[[A|B]]](https://freemwiki.com/wiki/A "A") or B from [[[B]]](https://freemwiki.com/wiki/B "B") or B from B (no wikilink markup).[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-464)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-465)In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-466)if str was wrapped in wikilink markup. Presumably, this is because without wikimarkup in str, there is no match[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-467)in the initial gsub, the replacement function l() doesn't get called.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-468)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-469)]=][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-470)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-471)local function remove_wiki_link (str)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-472)return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-473)return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-474)end));[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-475)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-476)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-477)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-478)--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-479)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-480)Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-481)If str is a complex wikilink ([[[L|D]]](https://freemwiki.com/wiki/L "L")):[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-482) returns wl_type 2 and D and L from [[[L|D]]](https://freemwiki.com/wiki/L "L");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-483)if str is a simple wikilink ([[[D]]](https://freemwiki.com/wiki/D "D"))[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-484) returns wl_type 1 and D from [[[D]]](https://freemwiki.com/wiki/D "D") and L as empty string;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-485)if not a wikilink:[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-486) returns wl_type 0, str as D, and L as empty string.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-487)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-488)trims leading and trailing whitespace and pipes from L and D ([[[L|]]](https://freemwiki.com/wiki/L "L") and [[|D]] are accepted by MediaWiki and[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-489)treated like [[[D]]](https://freemwiki.com/wiki/D "D"); while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-490)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-491)]=][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-492)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-493)local function is_wikilink (str)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-494)local D, L[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-495)local wl_type = 2;-- assume that str is a complex wikilink [[[L|D]]](https://freemwiki.com/wiki/L "L")[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-496)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-497)if not str:match ('^%[%[[^%]]+%]%]$') then-- is str some sort of a wikilink (must have some sort of content)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-498)return 0, str, '';-- not a wikilink; return wl_type as 0, str as D, and empty string as L[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-499)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-500)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-501)L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$');-- get L and D from [[[L|D]]](https://freemwiki.com/wiki/L "L") [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-502)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-503)if not is_set (D) then-- if no separate display[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-504)D = str:match ('^%[%[([^%]]*)|*%]%]$');-- get D from [[[D]]](https://freemwiki.com/wiki/D "D") or [[[D|]]](https://freemwiki.com/wiki/D "D")[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-505)wl_type = 1; [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-506)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-507)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-508)D = mw.text.trim (D, '%s|');-- trim white space and pipe characters [](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-509)return wl_type, D, L or '';[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-510)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-511)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-512)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-513)--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-514)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-515)Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-516)This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-517)markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-518)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-519)Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-520)to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-521)removed; returns the argument and nil when no markup removed[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-522)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-523)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-524)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-525)local function strip_apostrophe_markup (argument)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-526)if not is_set (argument) then[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-527)return argument, nil;-- no argument, nothing to do[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-528)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-529)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-530)if nil == argument:find ( "''", 1, true ) then-- Is there at least one double apostrophe? If not, exit.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-531)return argument, nil;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-532)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-533)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-534)local flag;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-535)while true do[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-536)if argument:find ("'''''", 1, true) then-- bold italic (5)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-537)argument, flag = argument:gsub ("%'%'%'%'%'", "");-- remove all instances of it[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-538)elseif argument:find ("''''", 1, true) then-- italic start and end without content (4)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-539)argument, flag=argument:gsub ("%'%'%'%'", "");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-540)elseif argument:find ("'''", 1, true) then-- bold (3)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-541)argument, flag=argument:gsub ("%'%'%'", "");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-542)elseif argument:find ("''", 1, true) then-- italic (2)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-543)argument, flag = argument:gsub ("%'%'", "");[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-544)else[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-545)break;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-546)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-547)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-548)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-549)return argument, flag;-- done[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-550)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-551)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-552)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-553)--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-554)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-555)Sets local cfg table to same (live or sandbox) as that used by the other modules.[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-556)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-557)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-558)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-559)local function set_selected_modules (cfg_table_ptr)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-560)cfg = cfg_table_ptr;[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-561)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-562)end[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-563)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-564)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-565)--[[--------------------------< E X P O R T S >----------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-566)]][](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-567)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-568)return {[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-569)add_maint_cat = add_maint_cat,-- exported functions[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-570)add_prop_cat = add_prop_cat,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-571)error_comment = error_comment,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-572)has_accept_as_written = has_accept_as_written,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-573)hyphen_to_dash = hyphen_to_dash,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-574)in_array = in_array,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-575)is_set = is_set,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-576)is_wikilink = is_wikilink,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-577)make_sep_list = make_sep_list,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-578)make_wikilink = make_wikilink,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-579)remove_wiki_link = remove_wiki_link,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-580)safe_for_italics = safe_for_italics,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-581)select_one = select_one,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-582)set_message = set_message,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-583)set_selected_modules = set_selected_modules,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-584)strip_apostrophe_markup = strip_apostrophe_markup,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-585)substitute = substitute,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-586)wrap_style = wrap_style,[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-587)[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-588)z = z,-- exported table[](https://freemwiki.com/index.php?oldid=579714&title=Module%3ACitation%2FCS1%2FUtilities#L-589)} Retrieved from "[https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&oldid=579714](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&oldid=579714)" * This page was last edited on 21 October 2025, at 06:18. * Content is available under [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) unless otherwise noted. FreemWiki is operated by **FINGERPOWER DIGITAL TECHNOLOGY LLC** (Colorado, Entity ID 20221978727). * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) * [Mobile view](https://freemwiki.com/index.php?title=Module:Citation/CS1/Utilities&oldid=579714&mobileaction=toggle_view_mobile)