LLWiki正在建设中,欢迎加入我们!
“模块:首页/日期”的版本间差异
跳转到导航
跳转到搜索
小 |
小 |
||
(未显示同一用户的4个中间版本) | |||
第4行: | 第4行: | ||
function p.main(frame) |
function p.main(frame) |
||
local args = getArgs(frame, {removeBlanks = false}) |
local args = getArgs(frame, {removeBlanks = false}) |
||
local n = #args |
|||
⚫ | |||
table.insert(args, '') |
|||
⚫ | |||
⚫ | |||
table.insert(args, '') |
|||
⚫ | |||
local text = '<div class="mainpage-news"><div class="mainpage-news-time">' |
local text = '<div class="mainpage-news"><div class="mainpage-news-time">' |
||
local hasTime = false |
local hasTime = false |
||
第22行: | 第14行: | ||
elseif i % 5 == 3 then |
elseif i % 5 == 3 then |
||
text = text..'('..v..')' |
text = text..'('..v..')' |
||
⚫ | |||
args[i + 1] = '' |
|||
⚫ | |||
elseif i % 5 == 4 and v ~= '' then |
elseif i % 5 == 4 and v ~= '' then |
||
hasTime = true |
hasTime = true |
||
text = text..' <span class="countdown-num">'..v..'</span>' |
text = text..' <span class="countdown-num">'..v..'</span>' |
||
⚫ | |||
args[i + 1] = '' |
|||
⚫ | |||
elseif i % 5 == 0 then |
elseif i % 5 == 0 then |
||
if hasTime then |
if hasTime then |
||
v = |
if v == '' then |
||
text = text..':<span class="countdown-num"> |
text = text..frame:expandTemplate{title = '0', args = {':'}}..'<span class="countdown-num"></span>' |
||
else |
|||
text = text..':<span class="countdown-num">'..string.format('%02d', v)..'</span>' |
|||
end |
|||
hasTime = false |
hasTime = false |
||
end |
end |
2022年2月1日 (二) 12:10的最新版本
可在模块:首页/日期/doc创建此模块的帮助文档
local p = {} local getArgs = require('module:arguments').getArgs function p.main(frame) local args = getArgs(frame, {removeBlanks = false}) local text = '<div class="mainpage-news"><div class="mainpage-news-time">' local hasTime = false for i, v in ipairs(args) do if i % 5 == 1 then text = text..'<span class="mainpage-date"><span class="countdown-num">'..v..'</span>/' elseif i % 5 == 2 then text = text..'<span class="countdown-num">'..v..'</span>' elseif i % 5 == 3 then text = text..'('..v..')' if args[i + 1] == nil then args[i + 1] = '' end elseif i % 5 == 4 and v ~= '' then hasTime = true text = text..' <span class="countdown-num">'..v..'</span>' if args[i + 1] == nil then args[i + 1] = '' end elseif i % 5 == 0 then if hasTime then if v == '' then text = text..frame:expandTemplate{title = '0', args = {':'}}..'<span class="countdown-num"></span>' else text = text..':<span class="countdown-num">'..string.format('%02d', v)..'</span>' end hasTime = false end text = text..'</span>' end end return text..'</div><div class="mainpage-news-content">' end return p