m>Dragons flight |
m>Dragons flight |
Line 1,139: |
Line 1,139: |
| | | |
| return text .. OCinS | | return text .. OCinS |
| end
| |
|
| |
| function r0(frame, name, group, page)
| |
| if ( name == nil ) then return "" end
| |
| if ( group == nil ) then group = "" end
| |
| local p = ""
| |
| if ( page ~= nil ) then
| |
| local contents = ":" .. page
| |
| p = createTag({name="sup",contents=contents,params={class="reference",style="white-space:nowrap;"}})
| |
| end
| |
| return createTag({name="ref",contents="",params={name=name,group=group}}, frame) .. p
| |
| end
| |
|
| |
| function reflist0(frame, config, args)
| |
| local contents = args.refs or ""
| |
| 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 ( "upper-alpha" == group or "lower-alpha" == group or "upper-roman" == group or "lower-roman" == group or "upper-greek" == group or "lower-greek" == group ) then
| |
| liststyle = group
| |
| else
| |
| liststyle = config.default_liststyle
| |
| end
| |
| end
| |
| local params = {}
| |
| params.class = "reflist"
| |
| params.style = z.wikitext.liststyle(liststyle)
| |
| if ( nil ~= count ) then
| |
| params.class = params.class .. " references-column-count references-column-count-" .. count
| |
| params.style = params.style .. " " .. z.wikitext.columncountstyle(count)
| |
| end
| |
| if ( nil ~= width ) then
| |
| params.class = params.class .. " references-column-width"
| |
| params.style = params.style .. " " .. z.wikitext.columnwidthstyle(width)
| |
| end
| |
| local references = createTag({name="references",contents=contents,params={group=group}}, frame)
| |
| return createTag({name="div",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 ( "upper-alpha" == group or "lower-alpha" == group or "upper-roman" == group or "lower-roman" == group or "upper-greek" == group or "lower-greek" == group ) then
| |
| liststyle = group
| |
| else
| |
| liststyle = config.default_liststyle
| |
| end
| |
| end
| |
| local params = {}
| |
| params.class = "refbegin"
| |
| params.style = z.wikitext.liststyle(liststyle)
| |
| if ( nil ~= count ) then
| |
| params.class = params.class .. " references-column-count references-column-count-" .. count
| |
| params.style = params.style .. " " .. z.wikitext.columncountstyle(count)
| |
| end
| |
| 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={style="text-indent: -" .. (indentsize or "3.2") .. "em;"}})
| |
| else
| |
| dlopen = ""
| |
| end
| |
| return z.wikitext.OpenHTMLTag({name="div",params=params}) .. dlopen
| |
| end
| |
|
| |
| function refend0(frame, 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 {{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 ""
| |
| 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 ""
| |
| return hideinprint("[[International Standard Serial Number|ISSN]] [http://www.worldcat.org/search?fq=x0:jrnl&q=n2:" .. Name .. " " .. Name .. "]")
| |
| 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(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 | | end |
|
| |
|
Line 1,273: |
Line 1,156: |
| | | |
| return citation0( config, args) | | return citation0( config, args) |
| end
| |
|
| |
| -- This is used by templates such as {{sfn}} to create the entire cross-reference.
| |
| function z.sfn(frame)
| |
| local pframe = frame:getParent()
| |
| local content = crossref(frame, pframe.args)
| |
| local args = { name = refid(pframe.args) }
| |
| return createTag({name = "ref", 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 = ""
| |
| -- 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["page" .. 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 ""
| |
| local P2 = args[2] or ""
| |
| local P3 = args[3] or ""
| |
| local id = nil
| |
| local contents = "[[#endnote_" .. P1 .. P3 .. "|[" .. P2 .. "]]]"
| |
| local params = {}
| |
| params.class="reference"
| |
| 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 {{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 ""
| |
| 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 = "[[#ref_" .. id .. arrow .. "|<b>" .. sup_arrow .. "</b>]]" .. postscript
| |
| if "none" == 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 = { class="citation wikicite" }
| |
| 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 {{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="ref",contents=(args[1] or ""),params={name=args.name,group=config.default_group}}, frame)
| |
| end | | end |
|
| |
|