אונטערשייד צווישן ווערסיעס פון "יחידה:תבנית מידע/אישיות"

ק
הגהה
(דאס?)
ק (הגהה)
שורה 14: שורה 14:
     end)
     end)
     return count
     return count
end
function enclosed(s)
return mw.ustring.sub(s, 1, 2) == "[[" and mw.ustring.sub(s, -2) == "]]" and count(s, "%[%[") == 1
end
end


שורה 213: שורה 217:
if genBirthDate == nil and templateArgs['תאריך לידה עברי'] ~= nil then
if genBirthDate == nil and templateArgs['תאריך לידה עברי'] ~= nil then
local l = frame:preprocess(templateArgs['תאריך לידה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
local l = frame:preprocess(templateArgs['תאריך לידה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
if (#mw.text.split(l, '%s' ) == 1 or mw.ustring.match(l, "^%[%[.-%]%]$") ~= nil) then --most probably just year or yearlink
if #mw.text.split(l, '%s' ) == 1 or enclosed(l) then --most probably just year or yearlink
if #mw.text.split(l, '%s' ) > 1 then
if #mw.text.split(l, '%s' ) > 1 then
l = l:match("%[%[.-|(.*)%]%]")
l = l:match("%[%[.-|(.*)%]%]")
שורה 232: שורה 236:
if genDeathDate == nil and templateArgs['תאריך פטירה עברי'] ~= nil then
if genDeathDate == nil and templateArgs['תאריך פטירה עברי'] ~= nil then
local p = frame:preprocess(templateArgs['תאריך פטירה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
local p = frame:preprocess(templateArgs['תאריך פטירה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
if (#mw.text.split(p, '%s' ) == 1 or mw.ustring.match(p, "^%[%[.-%]%]$") ~= nil) then --most probably just year or yearlink
if #mw.text.split(p, '%s' ) == 1 or enclosed(p) then --most probably just year or yearlink
if #mw.text.split(p, '%s' ) > 1 then
if #mw.text.split(p, '%s' ) > 1 then
p = p:match("%[%[.-|(.*)%]%]")
p = p:match("%[%[.-|(.*)%]%]")