Modul:Citace: Porovnání verzí

Smazaný obsah Přidaný obsah
PMID explicitně místo kouzelného odkazu
Jvs (diskuse | příspěvky)
podpora "background" pro odlišení test. šablony; oprava ve funkci p.lastChar; volání #time pro "datum přístupu"
Řádek 8:
function p.citaceInit(c)
c.r = {} -- result
c.flagsstate = {}
 
if type(c.frame.callParserFunction) == 'function' then
Řádek 14:
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
Řádek 19 ⟶ 20:
c.localTest = 1
c.args = c.frame
c.parentArgs = {}
-- makety vybranych fci pro lokalni testovani
mw = {
Řádek 27 ⟶ 29:
-- debugging options
-- c.noCoins = 1
-- c.trace = 1
-- c.dbg = 1
end
Řádek 68 ⟶ 70:
table.insert(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
Řádek 83 ⟶ 89:
local i
 
table.insert(c.r, '<cite class="book" style="font-style:normal;' .. p.style(c) .. '"')
p.citAnchorId(c)
table.insert(c.r, '>')
Řádek 118 ⟶ 124:
local i
 
table.insert(c.r, '<cite class="book" style="font-style:normal;' .. p.style(c) .. '"')
p.citAnchorId(c)
table.insert(c.r, '>')
Řádek 153 ⟶ 159:
local i
 
table.insert(c.r, '<cite style="font-style:normal;' .. p.style(c) .. '"')
p.citAnchorId(c)
table.insert(c.r, '>')
Řádek 207 ⟶ 213:
local i
 
table.insert(c.r, '<cite style="font-style:normal;' .. p.style(c) .. '"')
p.citAnchorId(c)
table.insert(c.r, '>')
Řádek 259 ⟶ 265:
local i
 
table.insert(c.r, '<cite style="font-style:normal;' .. p.style(c) .. '"')
p.citAnchorId(c)
table.insert(c.r, '>')
Řádek 377 ⟶ 383:
function p.lastChar(s)
if p.frame then
local len =return mw.ustring.lensub(s, -1)
return mw.ustring.sub(len, len)
else
return s:string.sub(s:len(), s:len()-1)
end
end
Řádek 468 ⟶ 473:
end
 
function p.style(c)
-- *** Pomocné funkce přidávající výstup do pole c.r ***
return (not p.empty(c.args['background']) and "background:" .. c.args['background'] .. ";" or "")
end
 
-- *** Pomocné funkce přidávající výstup do pole c.r ***
-- Odkazy pro harvardské citace
-- Srovnej cs:Modul:Footnotes / core() / grep CITEREF
Řádek 499 ⟶ 507:
 
if params.honorCorporation and not p.empty(c.args["korporace"]) then
tc.lastAutorstate.lastAuthor = c.args["korporace"]
table.insert(c.r, ""
.. p.wikilink(c.args["odkaz na korporaci"], c.args["korporace"])
Řádek 510 ⟶ 518:
 
-- if not p.empty(c.args["korporace"]) or not p.empty(c.args["autor1"]) or not p.empty(c.args["příjmení1"]) then
if not p.empty(tc.state.lastAuthor) then
if not p.empty(c.args["spoluautoři"]) then
tc.lastAutorstate.lastAuthor = c.args["spoluautoři"]
table.insert(c.r, ", " .. c.args["spoluautoři"])
end
Řádek 518 ⟶ 526:
 
if c.useHarvardFormat and not p.empty(c.args["rok"]) then
tc.lastAutorstate.lastAuthor = c.args["rok"]
table.insert(c.r, ", " .. c.args["rok"])
end
 
-- pokud posledni jmeno nekonci teckou, pak ji vlozime
-- DBG
if t.lastAutor ~= nil and p.lastChar(t.lastAutor) ~= '.' then
if nil and c.state.lastAuthor then
table.insert(c.r, "[" .. c.state.lastAuthor .. "/" .. p.lastChar(c.state.lastAuthor) .. "]")
end
 
if tc.lastAutor ~= nilstate.lastAuthor and p.lastChar(tc.state.lastAutorlastAuthor) ~= '.' then
table.insert(c.r, ".")
end
Řádek 530 ⟶ 543:
function p.citAuthor(t, c, i)
if c.trace then p.trace(c, debug.getinfo(1, "n")) end
local t = {}
t["autor"] = nil
 
Řádek 541 ⟶ 555:
 
if t["autor"] ~= nil then
tc.lastAutorstate.lastAuthor = t.autor
table.insert(c.r, ""
.. (i == 1 and "" or "; ")
Řádek 554 ⟶ 568:
 
if params.honorCorporation and not p.empty(c.args["sestavující korporace"]) then
tc.lastAutorstate.lastCompiler = c.args["sestavující korporace"]
table.insert(c.r, ""
.. p.wikilink(c.args["odkaz na sestavující korporaci"], c.args["sestavující korporace"])
Řádek 564 ⟶ 578:
end
 
if not p.empty(tc.lastAuthorstate.lastCompiler) then
if not p.empty(c.args["spolusestavitelé"]) then
tc.lastAutorstate.lastCompiler = c.args["spolusestavitelé"]
table.insert(c.r, ", " .. c.args["spolusestavitelé"])
else
Řádek 576 ⟶ 590:
 
-- pokud posledni jmeno nekonci teckou, pak ji vlozime
if tc.lastAutorstate.lastCompiler ~= nil and p.lastChar(tc.state.lastAutorlastCompiler) ~= '.' then
table.insert(c.r, ".")
end
Řádek 583 ⟶ 597:
function p.citCompiler(c, t, i)
if c.trace then p.trace(c, debug.getinfo(1, "n")) end
local t = {}
t["sestavitel"] = nil
 
Řádek 594 ⟶ 609:
 
if t["sestavitel"] ~= nil then
tc.lastAutorstate.lastCompiler = t.sestavitel
table.insert(c.r, ""
.. (i == 1 and "" or "; ")
Řádek 772 ⟶ 787:
table.insert(c.r, " ")
end
if c.localTest then
table.insert(c.r, "[cit. " .. c.args["datum přístupu"] .. "]");
else
-- TODO: {{#time: Y-m-d|{{{datum přístupu|{{{datum_přístupu}}}}}}}}] -- callParserFunction ??? // Celkove sjednotit zpracovani datumu
table.insert(c.r, "[cit. " .. p.frame:callParserFunction('#time', 'Y-m-d', c.args["datum přístupu"]) .. "]")
end
end
 
Řádek 785 ⟶ 803:
end
if not p.empty(t.datum) then
c.flagsstate.isDatum = true
if not p.empty(c.args["vydavatel"]) then
table.insert(c.r, ", " .. t.datum)
Řádek 827 ⟶ 845:
if c.trace then p.trace(c, debug.getinfo(1, "n")) end
if not p.empty(c.args["ročník"]) then
if c.flagsstate.isDatum then
table.insert(c.r, ", " .. (not p.empty(c.args["typ ročníku"]) and c.args["typ ročníku"] or "roč.") )
else