Module:Citation
---------------------------------------------------------------------
 -- Module:Citation - Lua module for Citation auxiliary templates
 ---------------------------------------------------------------------
 -- For the {{citation}} formatting functions, see: Module:Citation/CS1
 --                               (see NOTES at bottom)
 --require &quot;mw.text&quot;
 
 local z = {
     wikitext = require(&quot;Module:Wikitext&quot;),
     extensiontags = {
         nowiki = true,
         ref = true,
         gallery = true,
         pre = true,
         source = true,
         categorytree = true,
         charinsert = true,
         hiero = true,
         imagemap = true,
         inputbox = true,
         math = true,
         poem = true,
         ref = true,
         references = true,
         syntaxhighlight = true,
         timeline = true,
     }
 }
 
 function trim( str )
     if str == nil then
         return nil;
     end
     return str:match( &quot;^%s*(.-)%s*$&quot; );
 end
 
 function hideinprint(content)
     return content
 end
 
 function onlyinprint(content)
     return &quot;&quot;
 end
 
 -- This returns a string with HTML character entities for wikitext markup characters.
 function wikiescape(text)
     text = text:gsub( '[&amp;\'%[%]{|}]', {    
             ['&amp;'] = '&amp;#38;',    
             [&quot;'&quot;] = '&amp;#39;',    
             ['['] = '&amp;#91;',    
             [']'] = '&amp;#93;',	
             ['{'] = '&amp;#123;',	
             ['|'] = '&amp;#124;',	
             ['}'] = '&amp;#125;' } );
     return text;
 end
 
 function createTag(t, frame)
     local name = t.name or &quot;!-- --&quot;
     local content = t.contents or &quot;&quot;
     local attrs = {}
     if ( z.extensiontags[name] ) then
         -- We have to preprocess these, so that they are properly turned into so-called &quot;strip markers&quot; in the generated wikitext.
         if ( not frame ) then error (&quot;Please supply an extra frame argument to the createTag() function.&quot;) end
         local params = {}
         for n,v in pairs(t.params) do
             table.insert(params, &quot;|&quot; .. n .. &quot;=&quot; .. v)
         end
         return frame:preprocess(&quot;{{#tag:&quot; .. name .. &quot;|&quot; .. content .. table.concat(params) .. &quot;}}&quot;)
     else   
         for n,v in pairs(t.params) do
             if (v) then
                 table.insert(attrs, n .. &quot;=\&quot;&quot; .. wikiescape(v) .. &quot;\&quot;&quot;)
             else
                 table.insert(attrs, n)
             end
         end
         if (&quot;&quot; == content) then
             return &quot;&lt;&quot; .. name .. &quot; &quot; .. table.concat(attrs, &quot; &quot;) .. &quot;/&gt;&quot;
         else
             return &quot;&lt;&quot; .. name .. &quot; &quot; .. table.concat(attrs, &quot; &quot;) .. &quot;&gt;&quot; .. content .. &quot;&lt;/&quot; .. name .. &quot;&gt;&quot;
         end
     end
 end
 
 --[[
 This is a clone of mw.text.nowiki.  When the mw.text library is installed,
 this can be replaced by a call to that library. ]]
 function nowiki( s )
     -- string.gsub is safe here, because we're only caring about ASCII chars
     s = string.gsub( s, '[&quot;&amp;\'&lt;=&gt;%[%]{|}]', {
         ['&quot;'] = '&amp;#34;',
         ['&amp;'] = '&amp;#38;',
         [&quot;'&quot;] = '&amp;#39;',
         ['&lt;'] = '&amp;#60;',
         ['='] = '&amp;#61;',
         ['&gt;'] = '&amp;#62;',
         ['['] = '&amp;#91;',
         [']'] = '&amp;#93;',
         ['{'] = '&amp;#123;',
         ['|'] = '&amp;#124;',
         ['}'] = '&amp;#125;',
     } )
     s = string.sub( string.gsub( '\n' .. s, '\n[#*:;]', {
         [&quot;\n#&quot;] = &quot;\n&amp;#35;&quot;,
         [&quot;\n*&quot;] = &quot;\n&amp;#42;&quot;,
         [&quot;\n:&quot;] = &quot;\n&amp;#58;&quot;,
         [&quot;\n;&quot;] = &quot;\n&amp;#59;&quot;,
     } ), 2 )
     s = string.gsub( s, '://', '&amp;#58;//' )
     s = string.gsub( s, 'ISBN ', 'ISBN&amp;#32;' )
     s = string.gsub( s, 'RFC ', 'RFC&amp;#32;' )
 
     return s
 end
 
 function externallinkid(args)
     local sep = args.separator or &quot;&amp;nbsp;&quot;
     args.suffix = args.suffix or &quot;&quot;
     local url_string = args.id
     if args.encode == true or args.encode == nil then
         url_string = mw.uri.encode( url_string );
     end
     
     local t0 = onlyinprint(args.label .. sep .. args.id)
     local t1 = hideinprint(&quot;[[&quot; .. args.link .. &quot;|&quot; .. args.label .. &quot;]]&quot; .. sep .. &quot;[&quot; .. args.prefix .. url_string .. args.suffix .. &quot; &quot; .. nowiki(args.id) .. &quot;]&quot;)
     
     return t0 .. t1
 end
 
 function doi(id, inactive, nocat)
     local cat = &quot;&quot;
     local text;
     if ( inactive ~= nil ) then 
         text = &quot;[[Digital object identifier|doi]]:&quot; .. id;
         cat = cat .. &quot;[[Category:Pages with DOIs inactive since &quot; .. selectyear(inactive) .. &quot;]]&quot;
         inactive = &quot; (inactive &quot; .. inactive .. &quot;)&quot; 
     else 
         text = externallinkid({link=&quot;Digital object identifier&quot;,label=&quot;doi&quot;,prefix=&quot;http://dx.doi.org/&quot;,id=id,separator=&quot;:&quot;})
         inactive = &quot;&quot; 
     end
     if ( string.sub(id,1,3) ~= &quot;10.&quot; ) then
         cat = cat .. &quot;[[Category:Pages with DOI errors]]&quot; .. '&lt;span class=&quot;error&quot;&gt; Bad DOI (expected &quot;10.&quot; prefix) in code number&lt;/span&gt;'
     end
     if ( nocat and nocat ~= &quot;&quot; ) then cat = &quot;&quot; end
     return text .. inactive .. cat    
 end
 
 function selectyear( str )
     local lang = mw.getContentLanguage();
     local good, result;
     good, result = pcall( lang.formatDate, lang, 'Y', str )
     if good then 
         return result;
     else
         return '';
     end
 end
 
 function anchorid(label, args)
     local P1 = trim(args[1]) or &quot;&quot;
     local P2 = trim(args[2]) or &quot;&quot;
     local P3 = trim(args[3]) or &quot;&quot;
     local P4 = trim(args[4]) or &quot;&quot;
     local P5 = trim(args[5]) or &quot;&quot;
     local anchor = P1 .. P2 .. P3 .. P4 .. P5;
     if anchor ~= '' then  -- See bug description in Citation/CS1
         anchor = mw.uri.anchorEncode( anchor );
     end
     
     return label .. anchor
 end
 
 function refid(label, args)
     local p = args.p or &quot;&quot;
     local pp = args.pp or &quot;&quot;
     local loc = args.loc or &quot;&quot;
     return anchorid(label, args) .. p .. pp .. loc    
 end
 
 function name(args)
     local P1 = trim(args[1]) or &quot;&quot;
     if ( args[5] ~= nil) then
         return P1 .. &quot; et al.&quot;
     else
         local P2 = trim(args[2]) or &quot;&quot;
         local P3 = trim(args[3]) or &quot;&quot; 
         local P4 = trim(args[4]) or &quot;&quot;
         if ( args[4] ~= nil ) then
             P4 = &quot; &quot; .. P4
             P3 = &quot; &amp;amp; &quot; .. P3
             P2 = &quot;, &quot; .. P2
         elseif ( args[3] ~= nil ) then
             P3 = &quot; &quot; .. P3
             P2 = &quot; &amp;amp; &quot; .. P2
         elseif ( args[2] ~= nil ) then
             P2 = &quot; &quot; .. P2            
         end
         return P1 .. P2 .. P3 .. P4
     end 
 end
 
 function crossref(frame, label, args)
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local LB = config.BracketLeft or &quot;&quot;
     local RB = config.BracketRight or &quot;&quot;
     local anchor = args.ref or args.Ref or anchorid( label, args)
     local text = name(args)
     local loc = args.loc
     local page
     local pages = args.pp or args.pages
     if pages == nil or pages == '' then
         page = args.p or args.page;
     end 
     if nil == loc then loc = &quot;&quot; else loc = &quot; &quot; .. loc end
     if ( page ~= nil ) then
         local pagesep = config.PageSep or &quot;, p.&amp;nbsp;&quot;
         loc = loc .. pagesep .. page
     end
     if ( pages ~= nil ) then
         local pagessep = config.PagesSep or &quot;, pp.&amp;nbsp;&quot;
         loc = loc .. pagessep .. pages
     end        
     local pagename = args.pagename or &quot;&quot;
     local ps = args.Postscript or &quot;&quot;
     return LB .. &quot;[[&quot; .. pagename .. &quot;#&quot; .. anchor .. &quot;|&quot; .. text .. &quot;]]&quot; .. loc .. RB .. ps
 end
 
 function r0(frame, name, group, page)
     if ( name == nil ) then return &quot;&quot; end
     if ( group == nil ) then group = &quot;&quot; end
     local p = &quot;&quot;
     if ( page ~= nil ) then 
         local contents = &quot;:&quot; .. page
         p = createTag({name=&quot;sup&quot;,contents=contents,params={class=&quot;reference&quot;,style=&quot;white-space:nowrap;&quot;}}) 
     end
     return createTag({name=&quot;ref&quot;,contents=&quot;&quot;,params={name=name,group=group}}, frame) .. p
 end
 
 function reflist0(frame, config, args)
     local contents = args.refs or &quot;&quot;
     local liststyle = args.liststyle
     local count = args[1]
     local width = args.colwidth
     local group = args.group or config.default_group
     if ( nil == tonumber(count) and nil == width ) then 
         width = count
         count = nil
     end
     if ( nil == liststyle ) then
         if ( &quot;upper-alpha&quot; == group or &quot;lower-alpha&quot; == group or &quot;upper-roman&quot; == group or &quot;lower-roman&quot; == group or &quot;upper-greek&quot; == group or &quot;lower-greek&quot; == group ) then
             liststyle = group
         else
             liststyle = config.default_liststyle
         end
     end
     local params = {}
     params.class = &quot;reflist&quot;    
     params.style = z.wikitext.liststyle(liststyle)
     if ( nil ~= count ) then        
         params.class = params.class .. &quot; references-column-count references-column-count-&quot; .. count
         params.style = params.style .. &quot; &quot; .. z.wikitext.columncountstyle(count)
     end    
     if ( nil ~= width ) then
         params.class = params.class .. &quot; references-column-width&quot;
         params.style = params.style .. &quot; &quot; .. z.wikitext.columnwidthstyle(width)
     end
     local references = createTag({name=&quot;references&quot;,contents=contents,params={group=group}}, frame)
     return createTag({name=&quot;div&quot;,contents=references,params=params})
 end
 
 function refbegin0(frame, config, args)
     local liststyle = args.liststyle
     local indent = args.indent
     local indentsize = args.indentsize
     local count = args[1]
     local width = args.colwidth
     if ( nil == tonumber(count) and nil == width ) then 
         width = count
         count = nil
     end
     if ( nil == liststyle ) then
         if ( &quot;upper-alpha&quot; == group or &quot;lower-alpha&quot; == group or &quot;upper-roman&quot; == group or &quot;lower-roman&quot; == group or &quot;upper-greek&quot; == group or &quot;lower-greek&quot; == group ) then
             liststyle = group
         else
             liststyle = config.default_liststyle
         end
     end
     local params = {}
     params.class = &quot;refbegin&quot;
     params.style = z.wikitext.liststyle(liststyle)
     if ( nil ~= count ) then        
         params.class = params.class .. &quot; references-column-count references-column-count-&quot; .. count
         params.style = params.style .. &quot; &quot; .. z.wikitext.columncountstyle(count)
     end    
     if ( nil ~= width ) then
         params.class = params.class .. &quot; references-column-width&quot;
         params.style = params.style .. &quot; &quot; .. z.wikitext.columnwidthstyle(width)
     end
     local dlopen
     if ( nil ~= indent ) then
         dlopen = z.wikitext.OpenHTMLTag({name=&quot;dl&quot;,params={style=&quot;text-indent: -&quot; .. (indentsize or &quot;3.2&quot;) .. &quot;em;&quot;}})
     else
         dlopen = &quot;&quot;
     end
     return z.wikitext.OpenHTMLTag({name=&quot;div&quot;,params=params}) .. dlopen
 end
 
 function refend0(frame, config, args)
     local indent = args.indent
     local dlclose
     if ( nil ~= indent ) then
         dlclose = &quot;&lt;/dl&gt;&quot;
     else
         dlclose = &quot;&quot;
     end
     return dlclose .. &quot;&lt;/div&gt;&quot;
 end
 
 -- This is used by {{doi}} to create DOI links in the style used in citations.
 function z.doi(frame)
     local pframe = frame:getParent()
     local id = pframe.args.id or pframe.args[1] or &quot;&quot;
     return doi(id)
 end
 
 -- This is used by {{ISSN}} to create ISSN links in the style used in citations.
 function z.ISSN(frame)
     local pframe = frame:getParent()
     local Name = pframe.args[1] or &quot;&quot;
     return hideinprint(&quot;[[International Standard Serial Number|ISSN]]&amp;nbsp;[http://www.worldcat.org/search?fq=x0:jrnl&amp;q=n2:&quot; .. Name .. &quot; &quot; .. Name .. &quot;]&quot;)
 end
 
 -- This is used by templates such as {{SfnRef}} to create the (encoded) anchor name for a Harvard cross-reference hyperlink.
 function z.SFNID(frame)
     local pframe = frame:getParent()
     return anchorid('FOOTNOTE', pframe.args)
 end
 
 -- This is used by templates such as {{Harvard citation}} to create the Harvard cross-reference text.
 function z.Harvard(frame)
     local pframe = frame:getParent()
     return crossref(frame, pframe.args)
 end
 
 -- This is used by templates such as {{sfn}} to create the entire cross-reference.
 function z.sfn(frame)
     local pframe = frame:getParent()
     pframe.args.Postscript = pframe.args.postscript or pframe.args.ps or &quot;.&quot;;
     
     local content = crossref(frame, 'CITEREF', pframe.args)
     local args = { name = refid( 'FOOTNOTE', pframe.args) }
     return createTag({name = &quot;ref&quot;, contents = content, params = args}, frame)
 end
 
 -- This is used by template {{r}}.
 function z.r(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     args.page1 = args.page1 or args.page
     local text = &quot;&quot;
     -- This would be shorter using ipairs(), but that doesn't work on an arguments table supplied to a template.
     local index = 1
     while args[index] ~= nil do
         local arg = args[index]
         local t = r0(frame, arg, args.group, args[&quot;page&quot; .. index])
         text = text .. t
         index = index + 1
     end
     return text
 end
 
 -- This is used by template {{ref label}}.
 function z.reflabel(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     local P1 = args[1] or &quot;&quot;
     local P2 = args[2] or &quot;&quot;
     local P3 = args[3] or &quot;&quot;
     local id = nil
     local contents = &quot;[[#endnote_&quot; .. P1 .. P3 .. &quot;|&amp;#91;&quot; .. P2 .. &quot;&amp;#93;]]&quot;
     local params = {}
     params.class=&quot;reference&quot;
     if ( args.noid == nil or args.noid == &quot;&quot; ) then params.id = &quot;ref_&quot; .. P1 .. P3 end
     return createTag({name=&quot;sup&quot;,contents=contents,params=params})
 end
 
 -- This is used by template {{note label}}.
 function z.notelabel(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     local id = args[1] or &quot;&quot;
     local arrow = args[3] or &quot;&quot;
     local postscript = args[4] or &quot;&quot;
     local contents 
     if arrow ~= &quot;&quot; then
         local sup_arrow = createTag({name=&quot;sup&quot;,contents=arrow,params={}})
         contents = &quot;[[#ref_&quot; .. id .. arrow .. &quot;|&lt;b&gt;&quot; .. sup_arrow .. &quot;&lt;/b&gt;]]&quot; .. postscript
         if &quot;none&quot; == arrow then arrow = &quot;^&quot; end -- Change this AFTER using it in the ID parameter and the contents.
     else
         contents = (args[2] or &quot;&quot;) .. postscript
     end
     local params = { class=&quot;citation wikicite&quot; }
     if id ~= &quot;&quot; and ( args.noid == nil or args.noid == &quot;&quot; ) then 
         params.id = mw.uri.anchorEncode(&quot;endnote_&quot; .. id .. arrow)
     end
     return createTag({name=&quot;span&quot;,contents=contents,params=params})
 end
 
 -- This is used by templates {{reflist}} and {{notelist}}.
 function z.reflist(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     return reflist0(frame, config, args)
 end
 
 -- This is used by template {{refbegin}}.
 function z.refbegin(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     return refbegin0(frame, config, args)
 end
 
 -- This is used by template {{refend}}.
 function z.refend(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     return refend0(frame, config, args)
 end
 
 -- This is used by template {{efn}}.
 function z.efn(frame)
     local pframe = frame:getParent()
     local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
     local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
     return createTag({name=&quot;ref&quot;,contents=(args[1] or &quot;&quot;),params={name=args.name,group=config.default_group}}, frame)
 end
 
 return z
 ---------------------------------------------------------------------
 --NOTES
 --
 -- NOTE A1: This Lua module was originally designed to handle a mix
 --      of citation styles, crossing Vancouver style with Wikipedia's
 --      local Citation Style 1 (CS1) from {Template:Citation/core}.
 --      However, the conflicting positions of parameters, scattered
 --      in twisted locations across this module, led to a separate
 --      variation just to untangle the CS1 format of citations.
 --
 -- NOTE D2: The placement of dots and other separators between the
 --      displayed parameters has been a continual headache, to keep
 --      coordinated with the data in parentheses &quot;(data)&quot;. There
 --      has been a need to pre-check for the existence of related
 --      options, to keep from putting double-dots &quot;..&quot; in some cases.
 --      In particular, the omission of the &quot;title=&quot; parameter has led
 --      to several cases of a spurious dot &quot;. .&quot; because the original
 --      design had treated the title as a mandatory parameter.
 --
 ------------------------------------------------------------------------
 --HISTORY:
 --18Oct2012 Fixed lead-space in Chapter by omitting &quot; &quot;.
 --18Oct2012 Fixed lead-space in Chapter/Title as end &quot; &quot; of Authors/Date/...
 --19Oct2012 Put HISTORY comments to log major changes (not typos).
 --19Oct2012 Fixed extra dot &quot;..&quot; in Title by omitting at end of &quot;tcommon=...&quot;.
 --19Oct2012 For pages, put &amp;nbsp in &quot;p.&amp;nbsp;&quot; etc.
 --19Oct2012 Enhanced &quot;pages=&quot; to detect lone page as &quot;p.&quot; else &quot;pp.&quot; prefix.
 --19Oct2012 Fixed to show &quot;.&quot; after Periodical name (work, newspaper...).
 --19Oct2012 Fixed web-link to have spaces &quot;[...  Archived] from the original&quot;.
 --19Oct2012 Fixed to show &quot;;&quot; between authors &amp; coauthors.
 --19Oct2012 Fixed to omit extra &quot;.&quot; after coauthors.
 --20Oct2012 Fixed COinS data to not urlencode all, as &quot;ctx_ver=Z39.88-2004&quot;
 --20Oct2012 Fixed COinS to not end as &quot;&amp;&quot; but use lead &quot;&amp;rft...=&quot; form.
 --20Oct2012 Fixed COinS to not url.encode page's &quot;rfr_id=...&quot; pagename.
 --20Oct2012 Fixed COinS data when &quot;web&quot; to default to rft.genre &quot;book&quot;.
 --05Nov2012 Add a span wrapper even when there is no Ref parameter
 --15Feb2013 Added Agency for &quot;agency=xx&quot;.
 --19Feb2013 Put NOTES comments to explain module operation.
 --19Feb2013 Copied as Module:Citation/CS1 to alter to match wp:CS1 form.
 --19Feb2013 Changed OrigYear to use [__] for CS1 style.
 --19Feb2013 Fixed to not show duplicate Publisher/Agency.
 --19Feb2013 Moved page-number parameters to after final date.
 --19Feb2013 Fixed to not put double-dots after title again.
 --20Feb2013 Changed to omit dot &quot;.&quot; if already ends with dot.
 --20Feb2013 If class &quot;journal&quot; shows Publisher after Periodical/Series.
 --20Feb2013 Shifted Format to after Language, and Others after Volume.
 --20Feb2013 Set AccessDate + &lt;span class=&quot;reference-accessdate&quot;&gt;
 --20Feb2013 Fixed url when deadurl=no.
 --20Feb2013 Added sepc for separator character between parameters.
 --20Feb2013 Put &quot;OCLC&quot; for &quot;Online Computer Library Center&quot;.
 --20Feb2013 Fix empty &quot;authorlink=&quot; as person.link ~= &quot;&quot;.
 --20Feb2013 Added space after AuthorSep &amp; AuthorNameSep.
 --21Feb2013 Added args.contributor (was missing parameter).
 --21Feb2013 Fixed EditorSep (was misspelled &quot;EdithorSep&quot;).
 --21Feb2013 Set OCinSdata.rft_val_fmt = &quot;info:ofi/fmt:kev:mtx:book&quot;
 --21Feb2013 Checked to omit blank codes (asin= | doi= etc.).
 --21Feb2013 Set enddot to end line if not config.CitationClass &quot;citation&quot;.
 --21Feb2013 Fixed to show &quot;issn=x&quot; as the ISSN code.
 --21Feb2013 Fixed to show &quot;id=x&quot; after Zbl code.
 --21Feb2013 Changed to omit double-dot before date when already dot.
 --21Feb2013 Order config.CitationClass &quot;citation&quot;: Volume, Issue, Publisher.
 --21Feb2013 Put warning &quot;Bad DOI (expected &quot;10.&quot;..)&quot; in DOI result.
 --21Feb2013 Automatically unbolded volume+comma when &gt; 4 long.
 --21Feb2013 Changed to allow lowercase &quot;asin-tld&quot;.
 --22Feb2013 Fixed ref=harv to extract Year from Date.
 --22Feb2013 Set Harvard refer. span id if config.CitationClass &quot;citation&quot;.
 --22Feb2013 Fixed config.CitationClass &quot;citation&quot; as span class=&quot;citation&quot;.
 --22Feb2013 Capitalized &quot;Archived/Retrieved&quot; only when sepc is dot &quot;.&quot;.
 --23Feb2013 Fixed author editor for &quot;in&quot; or &quot;In&quot; and put space after sepc.
 --23Feb2013 Changed to omit dot in &quot;et al.&quot; when sepc is &quot;.&quot; separator.
 --23Feb2013 Fixed &quot;author1-first&quot; to also get args.given or args.given1.
 --23Feb2013 Fixed args.article to set Title, after Periodical is Title.
 --23Feb2013 Fixed to allow blank Title (such as &quot;contribution=mytitle&quot;).
 --23Feb2013 Fixed double-dot &quot;..&quot; at end of Editors list
 --26Feb2013 Moved &quot;issue=&quot; data to show before &quot;page=&quot;.
 --26Feb2013 Moved &quot;type=&quot; data to show after &quot;format=&quot;.
 --26Feb2013 For &quot;pmc=&quot; link, omitted suffix &quot;/?tool=pmcentrez&quot;.
 --27Feb2013 For coauthors, omitted extra separator after authors.
 --27Feb2013 For date, allowed empty date to use month/day/year.
 --27Feb2013 Fixed double-dot &quot;..&quot; at end of authors/coauthors list.
 --27Feb2013 Reset editor suffix as &quot;, ed.&quot; when date exists.
 --27Feb2013 Removed duplicate display of &quot;others=&quot; data.
 --27Feb2013 Removed parentheses &quot;( )&quot; around &quot;department&quot; TitleNote.
 --05Mar2013 Moved Language to follow Periodical or Series.
 --05Mar2013 Fixed Edition to follow Series or Volume.
 --05Mar2013 Fixed class encyclopaedia to show article as quoted Chapter.
 --05Mar2013 Fixed class encyclopaedia to show page as &quot;pp.&quot; or &quot;p.&quot;.
 --07Mar2013 Changed class encyclopaedia to omit &quot;( )&quot; around publisher.
 --07Mar2013 Fixed end double-dot by string.sub(idcommon,-1,-1) was &quot;-1,1&quot;.
 --13Mar2013 Removed enddot &quot;.&quot; after &quot;quote=&quot; parameter.
 --13Mar2013 Changed config.CitationClass &quot;news&quot; to use &quot;p.&quot; page format.
 --13Mar2013 Fixed missing &quot;location=&quot; when &quot;web&quot; or &quot;encyclopaedia&quot;.
 --14Mar2013 Fixed end double-dot after book/work title.
 --14Mar2013 Fixed double-dot before &quot;p.&quot; or &quot;pp.&quot; page number.
 --14Mar2013 Fixed config.CitationClass &quot;book&quot; to use p./pp. page.
 --