if ( nil ~= width ) then
params.class = params.class .. " references-column-width"
params.style = params.style .. " " .. z.wikitext.columnwidthstyle(width)
end
local dlopen
if ( nil ~= indent ) then
dlopen = z.wikitext.OpenHTMLTag({name="dl",params={ .. (indentsize or "3.2") .. "em;"}})
else
dlopen = ""
end
return z.wikitext.OpenHTMLTag({name="div",params=params}) .. dlopen
end  
function refend0(, config, args)
local indent = args.indent
local dlclose
if ( nil ~= indent ) then
dlclose = "</dl>"
else
dlclose = ""
end
return dlclose .. "</div>"
end  
-- This is used by to create DOI links in the style used in citations.
function z.doi
local pframe = :getParent
local id = pframe.args.id or pframe.args[1] or ""
return doi(id)
end  
-- This is used by to create ISSN links in the style used in citations.
function z.ISSN
local pframe = :getParent
local Name = pframe.args[1] or ""
return hideinprint("ISSN&nbsp;.. Name .. " " .. Name .. "")
end  
-- This is used by templates such as to create the (encoded) anchor name for a Harvard cross-reference hyperlink.
function z.SFNID
local pframe = :getParent
return anchorid('FOOTNOTE', pframe.args)
end  
-- This is used by templates such as to create the Harvard cross-reference text.
function z.Harvard
local pframe = :getParent
return crossref(, pframe.args)
end  
-- This is used by templates such as to create the entire cross-reference.
function z.sfn
local pframe = :getParent
pframe.args.Postscript = pframe.args.postscript or pframe.args.ps or ".";  
local content = crossref(, 'CITEREF', pframe.args)
local args = { name = refid( 'FOOTNOTE', pframe.args) }
return createTag({name = "ref", contents = content, params = args}, )
end  
-- This is used by template .
function z.r
local pframe = :getParent
local config = .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 = ""
-- 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(, arg, args.group, args["page" .. index])
text = text .. t
index = index + 1
end
return text
end  
-- This is used by template .
function z.reflabel
local pframe = :getParent
local config = .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 ""
local P2 = args[2] or ""
local P3 = args[3] or ""
local id = nil
local contents = "&#91;" .. P2 .. "&#93;"
local params = {}
params.
if ( args.noid == nil or args.noid == "" ) then params.id = "ref_" .. P1 .. P3 end
return createTag({name="sup",contents=contents,params=params})
end  
-- This is used by template .
function z.notelabel
local pframe = :getParent
local config = .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 ""
local arrow = args[3] or ""
local postscript = args[4] or ""
local contents
if arrow ~= "" then
local sup_arrow = createTag({name="sup",contents=arrow,params={}})
contents = "<b>" .. sup_arrow .. "</b>" .. postscript
if "" == arrow then arrow = "^" end -- Change this AFTER using it in the ID parameter and the contents.
else
contents = (args[2] or "") .. postscript
end
local params = { }
if id ~= "" and ( args.noid == nil or args.noid == "" ) then
params.id = mw.uri.anchorEncode("endnote_" .. id .. arrow)
end
return createTag({name="span",contents=contents,params=params})
end  
-- This is used by templates and .
function z.reflist
local pframe = :getParent
local config = .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(, config, args)
end  
-- This is used by template .
function z.refbegin
local pframe = :getParent
local config = .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(, config, args)
end  
-- This is used by template .
function z.refend
local pframe = :getParent
local config = .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(, config, args)
end  
-- This is used by template .
function z.efn
local pframe = :getParent
local config = .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="ref",contents=(args[1] or ""),params={name=args.name,group=config.default_group}}, )
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 "(data)". There
-- has been a need to pre-check for the existence of related
-- options, to keep from putting double-dots ".." in some cases.
-- In particular, the omission of the "title=" parameter has led
-- to several cases of a spurious dot ". ." because the original
-- design had treated the title as a mandatory parameter.
---
---
--HISTORY:
--18Oct2012 Fixed lead-space in Chapter by omitting " ".
--18Oct2012 Fixed lead-space in Chapter/Title as end " " of Authors/Date/...
--19Oct2012 Put HISTORY comments to log major changes (not typos).
--19Oct2012 Fixed extra dot ".." in Title by omitting at end of "tcommon=...".
--19Oct2012 For pages, put &nbsp in "p.&nbsp;" etc.
--19Oct2012 Enhanced "pages=" to detect lone page as "p." else "pp." prefix.
--19Oct2012 Fixed to show "." after Periodical name (work, newspaper...).
--19Oct2012 Fixed web-link to have spaces "[... Archived] from the original".
--19Oct2012 Fixed to show ";" between authors & coauthors.
--19Oct2012 Fixed to omit extra "." after coauthors.
--20Oct2012 Fixed COinS data to not urlencode all, as "ctx_ver=Z39.88-2004"
--20Oct2012 Fixed COinS to not end as "&" but use lead "&rft...=" form.
--20Oct2012 Fixed COinS to not url.encode page's "rfr_id=..." pagename.
--20Oct2012 Fixed COinS data when "web" to default to rft.genre "book".
--05Nov2012 Add a span wrapper even when there is no Ref parameter
--15Feb2013 Added Agency for "agency=xx".
--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 "." if already ends with dot.
--20Feb2013 If class "journal" shows Publisher after Periodical/Series.
--20Feb2013 Shifted Format to after Language, and Others after Volume.
--20Feb2013 Set AccessDate + <span>
--20Feb2013 Fixed url when deadurl=no.
--20Feb2013 Added sepc for separator character between parameters.
--20Feb2013 Put "OCLC" for "Online Computer Library Center".