Modul:Citace

Technology
12 hours ago
8
4
2
Avatar
Author
Albert Flores

require('strict')

local p = { }

function p.trace(c, dbgInfo, s) table.insert(c.r, "{p." .. dbgInfo.name .. (s and s or "") .. "}") end

function p.citaceInit(c) c.r = {} -- result c.state = {}

if type(c. frame. +morecallParserFunction) == 'function' then -- running as wiki module local aModule = require('Modul:Arguments') c. args = aModule. getArgs(c. frame) c. parentArgs = aModule. getArgs(c. frame:getParent) p. frame = c. frame -- zmena reseni, 30. 12. 2017 12:30:06 else -- running in console c. localTest = 1 c. args = c. frame c. parentArgs = {} -- makety vybranych fci pro lokalni testovani mw = { uri = { encode = p. identity } } -- debugging options c. noCoins = 1 c. trace = 1 -- c. dbg = 1 end.

if c.trace then p.trace(c, debug.getinfo(1, "n"), ':' .. c.type) end

-- zpětná kompatibilita c. args = p. +moreconvertUnderscoreArgs(c. args) p. provideArgs(c. args, { -- ["SRC"] = "DEST", ["příjmení"] = "příjmení1", ["jméno"] = "jméno1", ["autor"] = "autor1", ["odkaz na autora"] = "odkaz na autora1",.

["příjmení sestavitele"] = "příjmení sestavitele1", ["jméno sestavitele"] = "jméno sestavitele1", ["sestavitel"] = "sestavitel1", ["odkaz na sestavitele"] = "odkaz na sestavitele1",

["noviny"] = "periodikum", ["časopis"] = "periodikum", ["odkaz na noviny"] = "odkaz na periodikum", ["odkaz na časopis"] = "odkaz na periodikum",

["datum vydání"] = "datum", ["den vydání"] = "den", ["měsíc vydání"] = "měsíc", ["rok vydání"] = "rok",

["stránky"] = "strany", ["poznámka"] = "poznámky", ["titulorig"] = "titul původní", ["url alt"] = "url2",

["ISBN"] = "isbn", ["ISSN"] = "issn", })

c.printAnchor = not p.empty(c.args.ref) c.useHarvardFormat = c.printAnchor and c.args["typ refu"] ~= "normální"

if c. dbg then table. +moreinsert(c. r, "((DBG: ") for k, v in pairs(c. args) do table. insert(c. r, k . ' = ' . v . ';') end table. insert(c. r, "((PARENT)): ") for k, v in pairs(c. parentArgs) do table. insert(c. r, k . ' = ' . v . ';') end table. insert(c. r, " DBG_END))\n") end end.

function p. citace(frame) local c = { frame = frame } p. +morecitaceInit(c) if not p. empty(c. args["contribution"]) then c. args["sborník"] = c. args["title"] c. args["titul"] = c. args["contribution"] return p. citaceSborniku(frame) elseif not p. empty(c. args["periodikum"]) then return p. citacePeriodika(frame) else return p. citaceMonografie(frame) end end.

function p.citaceMonografie(frame) local c = { frame = frame } c.type = 'citaceMonografie' p.citaceInit(c)

table. insert(c. +morer, '') p. citAuthors(c, { maxAuthors = 7, honorCorporation = true }) p. citTitle(c) p. citOtherPersons(c) p. citEdition(c) p. citVolume(c) p. citPlacePublisher(c) p. citDate(c) p. citNumberOfVolumesPagesAppendices(c) p. citBookSeries(c) p. citUrl(c) p. citIsbn(c) p. citDoi(c) p. citPmid(c) p. citJstor(c) p. citS2cid(c) p. citBibcode(c) p. citArxiv(c) p. citOclc(c) p. citId(c) p. citChapterPage(c) p. citLanguage(c) p. citNotes(c) table. insert(c. r, '') p. citCoinsMonografie(c) p. tearDown(c) return table. concat(c. r) end.

function p.citaceElMonografie(frame) local c = { frame = frame } c.type = 'citaceElMonografie' p.citaceInit(c)

table. insert(c. +morer, '') p. citAuthors(c, { maxAuthors = 7, honorCorporation = true }) p. citTitle(c) p. citOtherPersons(c) p. citEdition(c) -- p. citVolume(c) p. citPlacePublisher(c) p. citDate(c) -- p. citNumberOfVolumesPagesAppendices(c) p. citBookSeries(c) p. citChapterPage(c) p. citNotes(c) p. citUrl(c) p. citIsbn(c) p. citDoi(c) p. citPmid(c) p. citJstor(c) p. citS2cid(c) p. citBibcode(c) p. citArxiv(c) p. citOclc(c) p. citId(c) p. citLanguage(c).

table.insert(c.r, '') p.citCoinsMonografie(c) p.tearDown(c) return table.concat(c.r) end

function p.citacePeriodika(frame) local c = { frame = frame } c.type = 'citacePeriodika' p.citaceInit(c)

p.supplyPeriodical(c)

table. insert(c. +morer, '') p. citAuthors(c, { maxAuthors = 7, honorCorporation = false }) p. citTitle(c) p. citOtherPersons(c) -- table. insert(c. r, " ") p. citPeriodical(c) -- table. insert(c. r, " ") p. citPlacePublisher(c) p. citDate(c) p. citYearNumberPage(c) -- table. insert(c. r, ". ") p. citNotes(c) p. citUrl(c) p. citIssn(c) p. citIsbn(c) p. citDoi(c) p. citPmid(c) p. citJstor(c) p. citS2cid(c) p. citBibcode(c) p. citArxiv(c) p. citId(c) p. citLanguage(c).

p.checkPeriodical(c)

table.insert(c.r, '') p.citCoinsPeriodikum(c) p.tearDown(c) return table.concat(c.r) end

function p.citaceElPeriodika(frame) local c = { frame = frame } c.type = 'citaceElPeriodika' p.citaceInit(c)

p.supplyPeriodical(c)

table. insert(c. +morer, '') p. citAuthors(c, { maxAuthors = 7, honorCorporation = false }) p. citTitle(c) p. citChapterPage(c) p. citOtherPersons(c) -- table. insert(c. r, " ") p. citPeriodical(c) -- table. insert(c. r, " ") p. citPlacePublisher(c) p. citDate(c) p. citYearNumberPage(c) -- table. insert(c. r, ". ") p. citNotes(c) p. citUrl(c) p. citIssn(c) p. citIsbn(c) p. citArxiv(c) p. citDoi(c) p. citBibcode(c) p. citPmid(c) p. citJstor(c) p. citS2cid(c) p. citId(c) p. citLanguage(c).

p.checkPeriodical(c)

table.insert(c.r, '') p.citCoinsPeriodikum(c) p.tearDown(c) return table.concat(c.r) end

function p.citaceSborniku(frame) local c = { frame = frame } c.type = 'citaceSborniku' p.citaceInit(c)

table. insert(c. +morer, '') p. citAuthors(c, { maxAuthors = 3, honorCorporation = true }) p. citTitle(c) table. insert(c. r, ' In: ') p. citCompilers(c, { maxAuthors = 3, honorCorporation = true }) p. citCompilation(c) p. citEdition(c) p. citPlacePublisher(c) p. citDate(c) p. citNotes(c) p. citUrl(c) p. citIsbn(c) p. citIssn(c) p. citDoi(c) p. citId(c) p. citVolume(c) p. citChapterPage(c) p. citLanguage(c) table. insert(c. r, '') -- p. citCoinsSbornik(c) p. tearDown(c).

return table.concat(c.r) end

function p.debug(frame)

--+moregetArgs(frame) end --'> if frame. callParserFunction ~= nil and type(callParserFunction) == 'function' then local aModule = require('Modul:Arguments') local args = aModule. getArgs(frame) end --.

-- local a = -- return 'Titul: ' .. args.titul .. ';'

result = {}

table.insert(result, type(frame))

for k, v in pairs(frame) do table.insert(result, k .. ' = ' .. type(v) .. '; ') end

return table.concat(result) end

function p.nowiki(c, txt) if type(c.frame.extensionTag)

'function' then return c.frame:extensionTag('nowiki', (txt and txt or ), {}) else if not p.empty(txt) then return " " else return "" end end end function p.identity(x) return x end function p.empty(x) -- return x

nil or x

0 or x

"" return x

nil or x

"" end

-- vrátí první neprázdný argument function p.coalesce(x, y) return ((x and x ~= "") and x or ((y and y ~= "") and y or "")) end

function p.coalesceN(len, args) for i = 1, len do local v = args[i] if v ~= nil and v ~= "" then return v end end return "" end

function p.provideArg(args, x, y) if args[x] == nil then args[x] = args[y] end end

function p.convertUnderscoreArgs(args) local t = {} t.args = {} for k, v in pairs(args) do k = tostring(k) t.k, t.count = k:gsub('_', ' ') t.args[t.k] = v end return t.args end

function p.provideArgs(args, map) for src, dest in pairs(map) do if (args[dest]

nil or args[dest]

"") and (args[url=://www.lua.org/pil/20.2.html -- '%.' matches a dot function p.normDate(d) return d:gsub('%. ', '.') end

function p.style(c) return (not p.empty(c.args['background']src] ~= nil and args[src] ~= "") then args[dest] = args[src] end end end

function p.plural(num, s1, s2, s3) num = tonumber(num) or 0 return (num == 1 and s1) or (1 0 then table.insert(c.r, ".") end end

function p.citTitle(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if not p.empty(c.args["titul"]) then table.insert(c.r, " ") if c.type

'citaceMonografie' then table.insert(c.r, "" .. "" .. p.nowiki(c) .. p.wikilink(c.args["odkaz na titul"], c.args["titul"]) .. p.nowiki(c) .. "" .. (not p.empty(c.args["titul původní"]) and " (původním názvem: " .. p.nowiki(c) .. c.args["titul původní"] .. p.nowiki(c) .. ")" or "") .. "." ) elseif c.type

'citaceElMonografie' then table. insert(c. +morer, "" . "" . p. nowiki(c) . p. wikilink(c. args["odkaz na titul"], c. args["titul"]) . p. nowiki(c) . "" . " " . p. nowiki(c, "[") . p. coalesceN(3, { c. args["druh nosiče"], c. args["formát"], "online" }) . p. nowiki(c, "]") . ". " ) else table. insert(c. r, "" . p. wikilink(c. args["odkaz na titul"], c. args["titul"]) . ". " ) end end end.

function p. citCompilation(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["sborník"]) then table. insert(c. r, " " . "" . p. nowiki(c) . p. wikilink(c. args["odkaz na sborník"], c. args["sborník"]) . p. nowiki(c) . "" . ". " ) end end.

function p. citPeriodical(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["periodikum"]) then table. insert(c. r, " " . "" . p. nowiki(c) . p. wikilink(c. args["odkaz na periodikum"], c. args["periodikum"]) . p. nowiki(c) . "" . (c. type.

"citaceElPeriodika" and " " .. p.nowiki(c, "[") .. p.coalesceN(3, { c.args["druh nosiče"], c.args["formát"], "online" }) .. p.nowiki(c, "]") or "" ) .. "." ) else table.insert(c.r, 'Chybí název periodika!') end end function p.citEdition(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if not p.empty(c.args["vydání"]) then table.insert(c.r, " " .. c.args["vydání"] .. "." .. (not p.empty(c.args["typ vydání"]) and ", " .. c.args["typ vydání"] or "") .. " vyd." ) end end function p.citVolume(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if not p.empty(c.args["svazek"]) then table.insert(c.r, " " .. (not p.empty(c.args["typ svazku"]) and p.upperFirst(c.args["typ svazku"]) or "Svazek") .. " " .. c.args["svazek"] .. "." ) end end -- dle ISO 690 platne od dubna 2011 uz neni vyzadovana mezera pred ":" function p.citPlacePublisher(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if c.type

'citacePeriodika' or c.type

'citaceElMonografie' or c.type

'citaceElPeriodika' then table. insert(c. +morer, "" . ((not p. empty(c. args["místo"]) or not p. empty(c. args["vydavatel"])) and " " or "") . "" . (not p. empty(c. args["místo"]) and " " . c. args["místo"] . ": " or "") . "" . (not p. empty(c. args["vydavatel"]) and p. wikilink(c. args["odkaz na vydavatele"], c. args["vydavatel"]) or "") ) else table. insert(c. r, "" . " " . (not p. empty(c. args["místo"]) and c. args["místo"] or "[s. l. ]") . ": " . (not p. empty(c. args["vydavatel"]) and p. wikilink(c. args["odkaz na vydavatele"], c. args["vydavatel"]) or "[s. n. ]") ) end end.

-- NOTE: Neprehledny kod. Pokud mozno zjednodusit, pripadne take sjednotit format data. +more function p. citDate(c) if c. trace then p. trace(c, debug. getinfo(1, "n")) end local t = {} t. datum = not p. empty(c. args["datum"]) and c. args["datum"] or p. dateCs(c. args).

if c.type

'citaceElMonografie' or c.type

'citaceElPeriodika' then if not p.empty(c.args["vydavatel"]) then t.finalDot = true end

if not p.empty(t.datum) then t.finalDot = true table.insert(c.r, "" .. (not p.empty(c.args["vydavatel"]) and ", " .. t.datum or " " .. p.upperFirst(t.datum)) ) end

if not p. empty(c. +moreargs["datum aktualizace"]) then t. finalDot = true if not p. empty(c. args["vydavatel"]) or not p. empty(t. datum) then table. insert(c. r, ", " . p. coalesce(c. args["typ aktualizace"], "rev. ")) elseif not p. empty(c. args["místo"]) then table. insert(c. r, " " . p. coalesce(c. args["typ aktualizace"], "rev. ")) else table. insert(c. r, " " . p. upperFirst(p. coalesce(c. args["typ aktualizace"], "rev. "))) end table. insert(c. r, " " . c. args["datum aktualizace"]) end.

if not p.empty(c.args["datum přístupu"]) then t.finalDot = true table.insert(c.r, " ") if not c.localTest and c.type

'citaceElMonografie' then table.insert(c.r, "[cit. " .. p.frame:callParserFunction('#time', 'Y-m-d', p.normDate(c.args["datum přístupu"])) .. "]") else table.insert(c.r, "[cit. " .. p.normDate(c.args["datum přístupu"]) .. "]") end end if (t.finalDot) then table.insert(c.r, ".") end elseif c.type

"citacePeriodika" then if not p. empty(c. +moreargs["vydavatel"]) then t. finalDot = true end t. datum = p. dateCs(c. args) if c. useHarvardFormat and t. datum == c. args["rok"] then t. datum = "" end if not p. empty(t. datum) then c. state. isDatum = true if not p. empty(c. args["vydavatel"]) then table. insert(c. r, ", " . t. datum) else table. insert(c. r, " " . p. upperFirst(t. datum)) end else if t. finalDot then table. insert(c. r, ". ") end end else t. datum = p. dateCs(c. args) -- was p. date.

if c.useHarvardFormat and t.datum == c.args["rok"] then t.datum = "" t.finalDot = true end

if t.datum ~= "" then table.insert(c.r, ", " .. t.datum) elseif not p.empty(c.args["rok copyrightu"]) then table.insert(c.r, ", c" .. c.args["rok copyrightu"]) end

if not p. empty(c. +moreargs["rok tisku"]) then if not p. empty(c. args["rok"]) or not p. empty(c. args["rok copyrightu"]) then table. insert(c. r, " (") else table. insert(c. r, ", ") end table. insert(c. r, p. dateCs(c. args, { postfix = " tisku" }) . " tisk") -- was p. date if not p. empty(c. args["rok"]) or not p. empty(c. args["rok copyrightu"]) then table. insert(c. r, ")") end end.

if t.datum ~= "" or not p.empty(c.args["rok tisku"]) or t.finalDot then table.insert(c.r, ".") end end end

-- refact/fix 1.6.2018 function p.citYearNumberPage(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end local t = {} t.ar = {}

if not p.empty(c.args["ročník"]) then table.insert(t.ar, (not p.empty(c.args["typ ročníku"]) and c.args["typ ročníku"] or "roč.") .. " " .. c.args["ročník"]) end

if not p.empty(c.args["číslo"]) then table.insert(t.ar, (not p.empty(c.args["typ čísla"]) and c.args["typ čísla"] or "čís.") .. " " .. c.args["číslo"]) end

if not p.empty(c.args["strany"]) then table.insert(t.ar, "s. " .. c.args["strany"]) end

-- test array length if #t. ar > 0 then if c. +morestate. isDatum then table. insert(c. r, ", " . table. concat(t. ar, ", ") . ". ") else table. insert(c. r, " " . p. upperFirst(table. concat(t. ar, ", ")) . ". ") end elseif c. state. isDatum then table. insert(c. r, ". ") end end.

-- refact 8.5.2018 function p.citChapterPage(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end local t = {} t.ar = {}

if not p. empty(c. +moreargs["kapitola"]) then table. insert(t. ar, "" . (not p. empty(c. args["typ kapitoly"]) and p. upperFirst(c. args["typ kapitoly"]) or "Kapitola") . " " . p. wikiextlink(c. args["url kapitoly"], c. args["kapitola"]) ) end if not p. empty(c. args["číslování"]) then table. insert(t. ar, c. args["číslování"]) end if not p. empty(c. args["strany"]) then table. insert(t. ar, "s. " . c. args["strany"]) end if not p. empty(c. args["lokace"]) then table. insert(t. ar, c. args["lokace"]) end.

-- test array length if #t.ar > 0 then table.insert(c.r, " " .. p.upperFirst(table.concat(t.ar, ", ")) .. ".") end end

-- pocetSvazku, pocetStranPlusPrilohy function p. citNumberOfVolumesPagesAppendices(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end local t = {} t. pocetSvazku = "" if not p. empty(c. args["počet svazků"]) and (tonumber(c. args["počet svazků"]) or 0) > 1 then t. pocetSvazku = " " . c. args["počet svazků"] . " " . p. plural(c. args["počet svazků"], "svazek", "svazky", "svazků") end if not p. empty(c. args["počet stran"]) then t. pocetStranPlusPrilohy = "" . c. args["počet stran"] . " s. " . (not p. empty(c. args["přílohy"]) and ", " . c. args["přílohy"] or "") else t. pocetStranPlusPrilohy = "" . (not p. empty(c. args["přílohy"]) and c. args["přílohy"] or "") end if t. pocetSvazku ~= "" then if (t. pocetStranPlusPrilohy ~= "") then table. insert(c. r, t. pocetSvazku . " (" . t. pocetStranPlusPrilohy . "). ") else table. insert(c. r, t. pocetSvazku . ". ") end else if (t. pocetStranPlusPrilohy ~= "") then table. insert(c. r, " " . t. pocetStranPlusPrilohy) if p. lastChar(t. pocetStranPlusPrilohy) ~= ". " then table. insert(c. r, ". ") end end end end.

function p. citBookSeries(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["edice"]) then table. insert(c. r, " " . "(" . p. upperFirst(c. args["edice"]) . (not p. empty(c. args["subedice"]) and ". " . p. upperFirst(c. args["subedice"]) or "") . (not p. empty(c. args["svazek edice"]) and p. nowiki(c, ';') . " sv. " . c. args["svazek edice"] or "") . "). " ) end end.

function p.citUrl(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end local t = {}

if c.type == 'citacePeriodika' then if not p.empty(c.args["url"]) then t.afterUrl = {}

if not p.empty(c.args["formát"]) then table.insert(t.afterUrl, c.args["formát"]) end

if not p. empty(c. +moreargs["datum přístupu"]) then table. insert(t. afterUrl, "cit. " . c. args["datum přístupu"]) elseif not p. empty(c. args["rok přístupu"]) then table. insert(t. afterUrl, "cit. " . c. args["rok přístupu"] . (not p. empty(c. args["měsíc přístupu"]) and "-" . c. args["měsíc přístupu"] . (not p. empty(c. args["den přístupu"]) and "-" . c. args["den přístupu"] or "") or "" )) end.

t.afterUrlStr = table.concat(t.afterUrl, ", ") if t.afterUrlStr ~= "" then t.afterUrlStr = " " .. p.nowiki(c, "[") .. t.afterUrlStr .. "]" end

c.state.afterUrlStr = t.afterUrlStr

p.citUrlInnerFn(c) end else if not p.empty(c.args["url"]) then p.citUrlInnerFn(c) end end

-- citacePeriodika --if not p. empty(c. +moreargs["url alt"]) then --table. insert(c. r, " [" . c. args["url alt"] . " (Alternativní odkaz)]") --end -- citaceElMonografie, citaceElPeriodika if not p. empty(c. args["url2"]) then table. insert(c. r, " " . p. coalesce(c. args["dostupnost2"], "Dostupné také na:") . " " . p. wikiextlink(c. args["url2"]) . ". " ) end if not p. empty(c. args["url3"]) then table. insert(c. r, " " . p. coalesce(c. args["dostupnost3"], "Dále dostupné na:") . " " . p. wikiextlink(c. args["url3"]) . ". " ) end end.

function p. citUrlInnerFn(c) local t = {} if not p. +moreempty(c. args["url archivu"]) then t. liveUrl = c. args["nedostupné"] ~= "ano" and c. args["dead-url"] ~= "yes" and c. args["deadurl"] ~= "yes" table. insert(c. r, " " . p. wikiextlink(c. args["url archivu"], p. coalesce(c. args["dostupnost"], "Dostupné v archivu")) . ((t. liveUrl or not p. empty(c. args["datum archivace"])) and " pořízeném" or "") . (t. liveUrl and " z " . p. wikiextlink(c. args["url"], "originálu") or "") . (not p. empty(c. args["datum archivace"]) and " dne " . c. args["datum archivace"] or "") . ". " ) else table. insert(c. r, " " . p. wikiextlink(c. args["url"], p. coalesce(c. args["dostupnost"], "Dostupné online")) . (c. state. afterUrlStr and c. state. afterUrlStr or "") . ". " ) end end.

function p. citIsbn(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["isbn"]) then -- OLD -- table. insert(c. r, " [. [International Standard Book Number|ISBN]. ] [url=https://worldcat. org/isbn/"]. c. args["isbn"[/url] . " " . c. args["isbn"] . "]. ") -- NEW if c. localTest then table. insert(c. r, " " . "{{ISBN|{}}}" . (not p. empty(c. args["isbn2"]) and ", {{ISBN|{}}}" or "") . ". " ) else table. insert(c. r, " " . c. frame:expandTemplate{title = 'ISBN', args = { c. args["isbn"] }} . (not p. empty(c. args["isbn2"]) and ", " . c. frame:expandTemplate{title = 'ISBN', args = { c. args["isbn2"] }} or "") . ". " ) end end end.

function p. citIssn(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["issn"]) then table. insert(c. r, " ISSN [url=https://worldcat. org/issn/"]. c. args["issn"[/url] . " " . c. args["issn"] . "]. ") end end.

function p. citDoi(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["doi"]) then table. insert(c. r, " DOI [url=http://dx. doi. org/"]. mw. uri. encode(c. args["doi"[/url]) . " " . mw. text. nowiki(c. args["doi"]) . "]. ") end end.

function p. citOclc(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["oclc"]) then table. insert(c. r, " OCLC [url=https://worldcat. org/oclc/"]. mw. uri. encode(c. args["oclc"[/url]) . " " . c. args["oclc"] . "]") end end.

function p. citPmid(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["pmid"]) then table. insert(c. r, " PMID [url=https://www. ncbi. nlm. nih. gov/pubmed/"]. c. args["pmid"[/url] . " " . c. args["pmid"] . "]. ") end end.

function p. citJstor(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["jstor"]) then table. insert(c. r, " JSTOR [url=https://www. jstor. org/stable/"]. c. args["jstor"[/url] . " " . c. args["jstor"] . "]. ") end end.

function p. citS2cid(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["s2cid"]) then table. insert(c. r, " S2CID [url=https://api. semanticscholar. org/CorpusID:"]. c. args["s2cid"[/url] . " " . c. args["s2cid"] . "]. ") end end.

function p. citBibcode(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["bibcode"]) then table. insert(c. r, " Bibcode [url=http://adsabs. harvard. edu/abs/"]. mw. uri. encode(c. args["bibcode"[/url]) . " " . c. args["bibcode"] . "]. ") end end.

function p. citArxiv(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end if not p. empty(c. args["arxiv"]) then table. insert(c. r, " arXiv [url=http://arxiv. org/abs/"]. mw. uri. encode(c. args["arxiv"[/url]) . " " . c. args["arxiv"] . "]. ") end end.

function p.citId(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if not p.empty(c.args["id"]) then table.insert(c.r, " " .. c.args["id"] .. ".") end end

function p.citNotes(c) if c.trace then p.trace(c, debug.getinfo(1, "n")) end if not p.empty(c.args["poznámky"]) then table.insert(c.r, " " .. p.upperFirst(c.args["poznámky"]) .. ".") end end

function p. checkPeriodical(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end local t = {} if p. empty(c. args["periodikum"]) then if c. localTest then t. chyba = else t. chyba = c. frame:expandTemplate{title = 'chyba', args = { 'Chybí povinný parametr: V šabloně ' . c. frame:expandTemplate{title = 'šablona', args = {'Citace periodika'}} . ' je nutno určit zdrojové "periodikum" odkazu. ', ['kategorie'] = 'Údržba:Chybná volání citačních šablon', ['skrytý'] = 'skrytý' }} end table. insert(c. r, t. chyba) end end.

-- Return only primary language subtag from IETF language tag function p. sanitizeLang(s) if type(s) ~= 'string' then return s end return mw. +moreustring. match(s, "^([a-z][a-z][a-z]. )-[A-Za-z][A-Za-z][A-Za-z]. $") or s end.

function p. citLanguage(c) if c. +moretrace then p. trace(c, debug. getinfo(1, "n")) end local t = {} if not p. empty(c. args["jazyk"]) then if c. localTest then t. jazykem = c. args["jazyk"] else local jazyk = p. sanitizeLang(c. args["jazyk"]) if jazyk ~= 'cs' then -- rychlotest local langModule = require('Modul:Language') local name = langModule. _getNameVJazyce(jazyk) if name then t. jazykem = name elseif jazyk ~= langModule. _getName('cs') and jazyk ~= langModule. _getNameVJazyce('cs') then t. jazykem = jazyk end end end if t. jazykem then table. insert(c. r, " (" . t. jazykem . ")") end end end.

function p. citCoinsMonografie(c) if c. +morenoCoins then return end if c. trace then p. trace(c, debug. getinfo(1, "n")) end local t = {} if c. type == 'citaceElMonografie' then t. tplName = 'citaceelmonografie' else t. tplName = 'citacemonografie' end t. coins = 'ctx_ver=Z39. 88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rfr_id=info:sid/cs. wikipedia. org:template' . t. tplName . '&rft. btitle=' . mw. uri. encode(p. coalesce(c. args["titul"])) . (not p. empty(c. args["doi"]) and "&rft_id=info:doi/" . mw. uri. encode(c. args["doi"]) or "") . (not p. empty(c. args["url"]) and "&rft_id=" . mw. uri. encode(c. args["url"]) or "") . (not p. empty(c. args["isbn"]) and "&rft. isbn=" . mw. uri. encode(c. args["isbn"]) or "") . (not p. empty(c. args["příjmení1"]) and "&rft. aulast=" . mw. uri. encode(c. args["příjmení1"]) or "") . (not p. empty(c. args["jméno1"]) and "&rft. aufirst=" . mw. uri. encode(c. args["jméno1"]) or "") . (not p. empty(c. args["autor1"]) and "&rft. au=" . mw. uri. encode(c. args["autor1"]) or "") . (not p. empty(c. args["příjmení2"]) and "&rft. au=" . mw. uri. encode(c. args["příjmení2"] . ", " . p. coalesce(c. args["jméno2"])) or "") . (not p. empty(c. args["autor2"]) and "&rft. au=" . mw. uri. encode(c. args["autor2"]) or "") . (not p. empty(c. args["příjmení3"]) and "&rft. au=" . mw. uri. encode(c. args["příjmení3"] . ", " . p. coalesce(c. args["jméno3"])) or "") . (not p. empty(c.

if c.localTest then t.coins = "(COinS:" .. t.coins .. ")" else t.coins = c.frame:expandTemplate{title = 'COinS', args = { obj = t.coins }} end table.insert(c.r, t.coins) end

function p. citCoinsPeriodikum(c) if c. +morenoCoins then return end if c. trace then p. trace(c, debug. getinfo(1, "n")) end local t = {} if c. type == 'citaceElPeriodika' then t. tplName = 'citaceelperiodika' else t. tplName = 'citaceperiodika' end t. coins = 'ctx_ver=Z39. 88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rfr_id=info:sid/cs. wikipedia. org:template' . t. tplName . '&rft. jtitle=' . mw. uri. encode(p. coalesce(c. args["periodikum"])) . (not p. empty(c. args["doi"]) and "&rft_id=info:doi/" . mw. uri. encode(c. args["doi"]) or "") . (not p. empty(c. args["url"]) and "&rft_id=" . mw. uri. encode(c. args["url"]) or "") . (not p. empty(c. args["titul"]) and "&rft. atitle=" . mw. uri. encode(c. args["titul"]) or "") . (not p. empty(c. args["datum"]) and "&rft. date=" . mw. uri. encode(c. args["datum"]) or (not p. empty(c. args["rok"]) and "&rft. date=" . mw. uri. encode(c. args["rok"]) . (not p. empty(c. args["měsíc"]) and "&rft. chron=" . (not p. empty(c. args["den"]) and mw. uri. encode(c. args["den"]) . ". " or "" ) . mw. uri. encode(c. args["měsíc"]) or "" ) or "" ) ) . (not p. empty(c. args["ročník"]) and "&rft. volume=" . mw. uri. encode(c. args["ročník"]) or "") . (not p. empty(c. args["číslo"]) and "&rft. issue=" . mw. uri. encode(c. args["číslo"]) or "") . (not p. empty(c. args["strany"]) and "&rft. pages=" . mw. uri. encode(c. args["strany"]) or "") . (not p. empty(c. args["issn"]) and "&rft.

if c.localTest then t.coins = "(COinS:" .. t.coins .. ")" else t.coins = c.frame:expandTemplate{title = 'COinS', args = { obj = t.coins }} end table.insert(c.r, t.coins) end

function p. tearDown(c) if not p. +moreempty(c. args['1']) then -- jako string kvůli p. convertUnderscoreArgs table. insert(c. r, 'Kategorie:Údržba:Citační šablona s nepojmenovaným parametrem') end end.

return p

5 min read
Share this post:
Like it 8

Leave a Comment

Please, enter your name.
Please, provide a valid email address.
Please, enter your comment.
Enjoy this post? Join Cesko.wiki
Don’t forget to share it
Top