Modul:Citace: Porovnání verzí

Smazaný obsah Přidaný obsah
Jvs (diskuse | příspěvky)
p.citUrl: refactoring kódu, redukce větvení; oprava omylu (dvě různé funkce se jménem p.citEdition)
Jvs (diskuse | příspěvky)
unifikace "url alt" > "url2"; fce p.supplyPeriodical() pro odvození periodika z url
Řádek 61:
["poznámka"] = "poznámky",
["titulorig"] = "titul původní",
["url alt"] = "url2",
})
 
Řádek 158 ⟶ 159:
local t = {} -- temp
local i
 
p.supplyPeriodical(c)
 
table.insert(c.r, '<cite style="font-style:normal;' .. p.style(c) .. '"')
Řádek 212 ⟶ 215:
local t = {} -- temp
local i
 
p.supplyPeriodical(c)
 
table.insert(c.r, '<cite style="font-style:normal;' .. p.style(c) .. '"')
Řádek 477 ⟶ 482:
function p.style(c)
return (not p.empty(c.args['background']) and "background:" .. c.args['background'] .. ";" or "")
end
 
function p.supplyPeriodical(c)
local t = {}
if p.empty(c.args["periodikum"]) and not p.empty(c.args["url"]) then
t.urlRegex = "^https?://([^/]*)"
if p.frame then
t.periodikum = mw.ustring.match(c.args["url"], t.urlRegex)
else
t.periodikum = string.match(c.args["url"], t.urlRegex)
end
if t.periodikum then
c.args["periodikum"] = t.periodikum
end
end
end
 
Řádek 1 025 ⟶ 1 045:
 
-- citacePeriodika
--if not p.empty(c.args["url alt"]) then
--table.insert(c.r, " [" .. c.args["url alt"] .. " (Alternativní odkaz)]")
--end
-- citaceElMonografie, citaceElPeriodika
if not p.empty(c.args["url2"]) then