Module:Chabad Days: Difference between revisions
Regular hyphens instead of long dashes |
Footer link as a button; button() for box button rows |
||
| Line 29: | Line 29: | ||
if greg then out = out .. ' (' .. greg .. ')' end | if greg then out = out .. ' (' .. greg .. ')' end | ||
return out, b3 .. ucfirstText(text) | return out, b3 .. ucfirstText(text) | ||
end | |||
function p._button(target, pageName, year) | |||
return '<span style="display:inline-block; padding:0.25em 0.9em; border:1px solid #a2a9b1; border-radius:4px; background:#ffffff;">[[' .. | |||
target .. '#Chabad Days|' .. pageName .. ' ' .. year .. ' - More on this day]]</span>' | |||
end | |||
-- button only, for use in a box's button row | |||
function p.button(frame) | |||
local day = frame:callParserFunction('#time', 'xjj') | |||
local month = frame:callParserFunction('#time', 'xjF') | |||
month = MONTHS[month] or month | |||
local pageName = day .. ' ' .. month | |||
local title = mw.title.new(pageName) | |||
if not (title and title.exists) then return '' end | |||
if title.isRedirect and title.redirectTarget then title = title.redirectTarget end | |||
return p._button(title.fullText, pageName, frame:callParserFunction('#time', 'xjY')) | |||
end | end | ||
| Line 82: | Line 99: | ||
end | end | ||
local year = frame:callParserFunction('#time', 'xjY') | local year = frame:callParserFunction('#time', 'xjY') | ||
local footer = '<div style="clear:both; text-align:right; margin-top:0.4em;">' .. | local target = content and title.fullText or nil | ||
local footer = '' | |||
if args.button ~= 'no' and target then | |||
footer = '<div style="clear:both; text-align:right; margin-top:0.4em;">' .. p._button(target, pageName, year) .. '</div>' | |||
end | |||
return '<div style="text-align:justify;">\n' .. body .. '\n</div>\n' .. footer | return '<div style="text-align:justify;">\n' .. body .. '\n</div>\n' .. footer | ||
end | end | ||
return p | return p | ||