Content deleted Content added
sync from live |
add function makeCatLink(catname, disp) to avoid calls to template |
||
Line 1:
local p = {}
-- Make a piped link to a category, if it exists
-- If it doesn't exist, just display the greyed the link title without linking
function makeCatLink(catname, disp)
local displaytext
if (disp ~= "") and (disp ~= nil) then
-- use 'disp' parameter, but strip any trailing disambiguator
displaytext = mw.ustring.gsub(disp, "%s+%(.+$", "");
else
displaytext = catname
end
local fmtlink
local catPage = mw.title.new( catname, "Category" )
if (catPage.exists) then
fmtlink = "[[:Category:" .. catname .. "|" .. displaytext .. "]]"
blueLinkCount = blueLinkCount + 1
else
fmtlink = '<span style="color:' .. greyLinkColor .. '">' .. displaytext .. "</span>"
greyLinkCount = greyLinkCount + 1
end
return fmtlink
end
function p.navyear(frame)
Line 23 ⟶ 46:
if i ~= 0 then
if ((year >= arg4) and (year <= arg5)) then
navyear = navyear .. '*' ..
else
navyear = navyear..'*<span style="visibility:hidden">'..year..'</span>\n'
|