请输入您要查询的百科知识:

 

词条 Module:Cite LSA
释义

local p = {}

function p.cite(frame)

local pframe = frame:getParent()

local config = frame.args

local args = pframe.args

local authorfirst = {}

local authorlast = {}

local editorfirst = {}

local editorlast = {}

local title = args.title

local journal = args.journal

local chapter = args.chapter

local series = args.seriestitle or args.series

local year = args.year

local volume = args.volume

local edition = args.edition

local pages = args.pages

local publisher = args.publisher

local author = args.last

local url = args.url

local accessdate = args.accessdate

local editorlist = nil

local place = args.place

local citation = nil

argTable = {title,journal,chapter,series, year, volume, edition,pages,publisher,editors,place}

for k,v in pairs(args) do

if string.find(k, "first") ~= nil then

if string.find(k, "%d") ~= nil then

i,j = string.find(k, "%d")

num = string.sub(k,i,j)

num = tonumber(num)

else

num = 1

end

if string.find(k, "editor") ~= nil then

editorfirst[num] = v

else

authorfirst[num] = v

end

elseif string.find(k, "last") ~= nil then

if string.find(k, "%d") ~= nil then

i,j = string.find(k, "%d")

num = string.sub(k,i,j)

num = tonumber(num)

else

num = 1

end

if string.find(k, "editor") ~= nil then

editorlast[num] = v

else

authorlast[num] = v

end

end

end

if table.getn(authorlast) < 1 and publisher ~= nil then

authorlist="" .. publisher .. ". "

author=""

elseif table.getn(authorlast) > 0 then

alimit = table.getn(authorlast)

for i,v in ipairs(authorlast) do

if i == 1 then

authorlist = "" .. authorlast[1] .. ", " .. authorfirst[1] .. ""

elseif i > 1 and i <= alimit then

authorlist = authorlist .. "" .. authorfirst[i] .. " " .. authorlast[i] .. ""

end

if i+1 == alimit then

authorlist = authorlist .. ", and "

elseif alimit == 1 then

authorlist = authorlist .. ". "

elseif alimit > 2 and i ~= alimit then

authorlist = authorlist .. "; "

elseif i == alimit then

authorlist = authorlist .. ". "

end

end

end

if editorlast ~= {} then

editorlist = ""

elimit = table.getn(editorlast)

for i,v in ipairs(editorlast) do

editorlist = editorlist .. editorfirst[i] .. " " .. editorlast[i]

if i+1 == elimit and editorlist ~= " " then

editorlist = editorlist .. ", and "

elseif elimit > i and editorlist ~= " " then

editorlist = editorlist .. ", "

end

end

if editorlist == "" or editorlist == " " then

editorlist = ""

end

end

if author ~= nil then

authorlist = authorlist .. year .. ". "

elseif author == nil then

authorlist = "Missing author name" .. year .. ". "

end

if journal ~= nil then

if url ~= nil then

if accessdate ~= nil then

citation = authorlist .. "[" .. url .. " " .. title .. "]. \\'\\'" .. journal .. "\\'\\' " .. volume .. ". " .. pages .. ". Accessed " .. accessdate .. "."

else

citation = authorlist .. "[" .. url .. " " .. title .. "]. \\'\\'" .. journal .. "\\'\\' " .. volume .. ". " .. pages .. ". Missing accessdate"

end

else

citation = authorlist .. title .. ". \\'\\'" .. journal .. "\\'\\' " .. volume .. ". " .. pages .. ". "

end

elseif journal == nil then

if chapter ~= nil then

if url ~= nil then

citation = authorlist .. "[" .. url .. " " .. chapter .. "]."

else

citation = authorlist .. chapter .. ". "

end

if title ~= nil then

citation = citation .. "\\'\\'" .. title .. "\\'\\'"

if editorlist ~= nil and editorlist ~= "" then

citation = citation .. " ed. by " .. editorlist

end

if pages ~= nil then

citation = citation .. ", " .. pages .. ". "

else

citation = citation .. ". "

end

if edition ~= nil and volume ~= nil then

citation = citation .. edition .. ", " .. volume .. "; "

elseif edition ~= nil and volume == nil then

citation = citation .. edition .. "; "

elseif edition == nil and volume ~= nil then

citation = citation .. volume .. "; "

end

if series ~= nil then

citation = citation .. "(" .. series .. "). "

end

if place ~= nil and publisher ~= nil then

citation = citation .. place .. ": " .. publisher .. "."

elseif place ~= nil and publisher == nil then

citation = citation .. place .. "."

elseif place == nil and publisher ~= nil then

citation = citation .. publisher .. "."

end

if url ~= nil then

if accessdate ~= nil then

citation = citation .. " Accessed " .. accessdate .. ". "

else

citation = citation .. "Missing accessdate"

end

end

end

else

if title ~= nil then

if url ~= nil then

citation = authorlist .. "\\'\\'[" .. url .. " " .. title .. "]\\'\\'"

else

citation = authorlist .. "\\'\\'" .. title .. "\\'\\'"

end

if editorlist ~= nil and editorlist ~= "" then

citation = citation .. ", ed. by " .. editorlist

end

if pages ~= nil then

citation = citation .. ", " .. pages .. ". "

else

citation = citation .. ". "

end

if edition ~= nil and volume ~= nil then

citation = citation .. edition .. ", " .. volume .. "; "

elseif edition ~= nil and volume == nil then

citation = citation .. edition .. "; "

elseif edition == nil and volume ~= nil then

citation = citation .. volume .. "; "

end

if series ~= nil then

citation = citation .. "(" .. series .. "). "

end

if place ~= nil and publisher ~= nil then

citation = citation .. place .. ": " .. publisher .. "."

elseif place ~= nil and publisher == nil then

citation = citation .. place .. "."

elseif place == nil and publisher ~= nil then

citation = citation .. publisher .. "."

end

if url ~= nil then

if accessdate ~= nil then

citation = citation .. " Accessed " .. accessdate .. "."

else

citation = citation .. "Missing accessdate"

end

end

end

end

end

return citation

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/18 13:14:35