Content deleted Content added
←Created page with '--v01 -- config local textSize = '90%' local tableClass="infobox" local tableFallbackWidth="75%" local tableWidth="calc(100% - 300px)" local tableStyle="m...' |
max-width |
||
(12 intermediate revisions by the same user not shown) | |||
Line 5:
local textSize = '90%'
local tableClass="infobox"
local
local
local tableStyle="margin-left:auto; margin-right:auto; clear:left; float:left;"
local
local labelStyle = "text-align:right; font-weight: bold;"
local listStyle = "text-align:left; font-weight: normal;"
Line 31 ⟶ 30:
function makeTableRow()
debugLog(2, "makeTableRow")
thisRow = '<tr style="' .. RowStyle .. '">'
thisRow = thisRow .. '<td style="' .. listStyle .. ';"><div class="hlist">\n'
for i = -5, 5 do
thisRow = thisRow .. "* " .. makeCatLink(thisPageDecade + (i * 10)) .. "\n"
end▼
thisRow = thisRow .. '</div></td>\n</tr>\n'
return thisRow
Line 41 ⟶ 42:
function makeTable()
if true then▼
▲end
debugLog(1, "makeTable")
tableRowNum = 0
local myTable = '<table class="' .. tableClass .. '"'
myTable = myTable .. ' style="' .. tableStyle .. '; font-size:' .. textSize .. '; max-width:' ..
myTable = myTable .. makeTableRow("")
myTable = myTable .. "</table>\n"
Line 54 ⟶ 52:
-- Make a piped link to a decade category, if it exists▼
▲-- 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(
local decadeFulltext = tostring(math.abs(x)) .. 's'
if
decadeFulltext = decadeFulltext .. " BC"
end
local catname = title_prefix .. decadeFulltext .. title_suffix
local fmtlink
local catPage = mw.title.new( catname, "Category" )
if (catPage.exists) then
fmtlink = "[[:Category:" .. catname .. "|" ..
else
fmtlink = '<span style="color:' .. greyLinkColor .. '">' ..
end
Line 94 ⟶ 90:
function parsePagename(pn)
debugLog(1, "parsePagename: [" .. pn .. "]")
match_prefix, match_decade, match_suffix = mw.ustring.match(pn, "^(.
if match_decade == nil then
match_prefix, match_decade, match_suffix = mw.ustring.match(pn, "^(.
end
if match_decade == nil then
Line 102 ⟶ 98:
return false
end
debugLog(2, 'Split [' .. pn .. ']: /' .. match_prefix .. '/' .. match_decade ..'/' .. match_suffix ..'/')
if (match_prefix ~= nil) and (match_prefix ~= "") then
if (mw.ustring.sub(match_prefix, -1 ) ~= ' ') then
debugLog(2, 'Invalid. [' .. pn .. '] has no space before decade
return false
end
end
end▼
if (match_suffix ~= nil) and (match_suffix ~= "") then
if (mw.ustring.sub(match_suffix, 1, 1) ~= ' ') then
debugLog(2, 'Invalid. [' .. pn .. '] has no space after decade
return false
end
Line 128 ⟶ 124:
match_decade = mw.ustring.gsub(match_decade, "0s$", "0")
thisPageDecade = tonumber(match_decade)
thisPageDecade = -thisPageDecade
▲ end
title_prefix = match_prefix
|