Module:UpdateExcerpt: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| (13 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local function _render(month, day, year, maxLines, frame) | local function _render(month, day, year, maxLines, frame) | ||
if not month or month == "" or not day or day == "" or not year or year == "" then | if not month or month == "" or not day or day == "" or not year or year == "" then | ||
| Line 36: | Line 33: | ||
local html = string.format( | local html = string.format( | ||
'<div style="flex:1; min-height:0; overflow-y:auto | '<div style="flex:1; min-height:0; overflow-y:auto; padding:14px 18px; font-family: sans-serif; font-size:0.92em; line-height:1.7;">\n__NOEDITSECTION__\n%s\n</div>', | ||
frame:preprocess(notesRaw) | frame:preprocess(notesRaw) | ||
) | ) | ||
| Line 44: | Line 40: | ||
end | end | ||
function p.getDateLink(frame) | |||
local parentArgs = frame:getParent().args or {} | |||
local args = frame.args or {} | |||
local month = parentArgs.month or args.month or parentArgs[1] or args[1] or "" | |||
local day = parentArgs.day or args.day or parentArgs[2] or args[2] or "" | |||
local year = parentArgs.year or args.year or parentArgs[3] or args[3] or "" | |||
month = mw.text.trim(month) | |||
day = mw.text.trim(day) | |||
year = mw.text.trim(year) | |||
if month == "" or day == "" or year == "" then | |||
local latestUpdate = require("Module:LatestUpdate") | |||
if month == "" then month = latestUpdate.month() end | |||
if day == "" then day = latestUpdate.day() end | |||
if year == "" then year = latestUpdate.year() end | |||
end | |||
return "[[Update:" .. month .. " " .. day .. ", " .. year .. "| ".. month .. " " .. day .. ", " .. year .. "]]" | |||
end | |||
function p.render(frame) | function p.render(frame) | ||
local args = frame.args | local args = frame.args | ||
| Line 59: | Line 74: | ||
end | end | ||
function p.drawWidget(frame) | function p.drawWidget(frame) | ||
local parentArgs = frame:getParent().args | local parentArgs = frame:getParent().args | ||
| Line 111: | Line 123: | ||
footer:tag("span") | footer:tag("span") | ||
:addClass("update-excerpt__readmore") | :addClass("update-excerpt__readmore") | ||
:wikitext("[[Update:" .. month .. " " .. day .. ", " .. year .. "|Read more]]") | |||
return tostring(html) | return tostring(html) | ||