Module:VG titles:修订间差异
外观
删除的内容 添加的内容
小 (Wikiplus) |
撤销Ваш паспорт, пожалуйста.(讨论)的版本38220789 |
||
第91行: | 第91行: | ||
function p.item(frame) |
function p.item(frame) |
||
local args = getArgs(frame, { |
local args = getArgs(frame, {frameOnly = true}) |
||
frameOnly = true, |
|||
valueFunc = function (key, value) |
|||
if key == 'notes' and string.sub( value, -1, -1 ) == '\n' then |
|||
value = string.sub( value, 1, -2 ) |
|||
end |
|||
return value |
|||
end, |
|||
} ) |
|||
if args.release == nil then |
if args.release == nil then |
2015年12月6日 (日) 16:26的版本
require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
local function left(args, rowspan)
local function article(args)
local core
if args.article then
core = string.format('[[%s|%s]]', args.article, args.title or args.article)
else
core = args.title or '<span class="error">未填写<code>title =</code>参数</span>'
end
return string.format('<div class="fn" style="margin-bottom: 4pt;">%s</div>', core)
end
local function release(args)
local status, date
if args.platform then
return string.format('<div>%s - %s%s</div>',
args.date or '<span class="error">未填写<code>date =</code>参数</span>',
args.platform,
args.refs or ''
)
end
if yesno(args.series) then
return (args.date or '') .. (args.refs or '')
end
if yesno(args.futuregame) then
status, date = '预定发行日期', args.date
elseif args.canceled then
status, date = '原定发行日期', args.canceled
else
status = '首发日期'
date = args.date or '<span class="error">未填写<code>date =</code>参数</span>'
end
return string.format('<div><b>%s</b>%s:<br />%s</div>', status, args.refs or '', date)
end
return string.format('\n| scope="row" id="%s" style="%s" rowspan="%s" | %s',
args.anchor or args.title or '',
'vertical-align: middle; width: 24em; text-align: center; background-color:transparent;',
rowspan,
article(args) .. release(args)
)
end
local function right1(args)
local status
if yesno(args.futuregame) then
status = '预定平台与发行年份'
elseif args.canceled then
status = '原定平台与发行年份'
else
status = '各平台发行年份'
end
return '\n| td valign="top" | <b>' .. status .. '</b>:\n' ..args.release
end
local function right2(args)
return '\n| valign="top" | <b>备注</b>:\n' .. (args.notes or '')
end
function p.main(frame)
local args = getArgs(frame, { frameOnly = true } )
-- Main module code goes here.
local ret
ret =
'{| table cellspacing="0" cellpadding="4" border="1" class="wikitable" width="100%" align="center" style="border-collapse: collapse;"' ..
'\n|-' ..
'\n! scope="col" | 作品' ..
'\n! scope="col" | 信息' ..
'\n' .. (args[1] or '') ..
'\n|}'
return ret
end
function p.item(frame)
local args = getArgs(frame, {frameOnly = true})
if args.release == nil then
return '\n|-' .. left(args, '1') .. right2(args)
end
if args.notes == nil then
return '\n|-' .. left(args, '1') .. right1(args)
end
return '\n|-' .. left(args, '2') .. right1(args) .. '\n|-' .. right2(args)
end
return p