编辑“︁
Module:沙盒/Datou 1996/test
”︁
跳转到导航
跳转到搜索
File:AnonEditWarning.svg
您当前没有登录。
如果您保存任何编辑,您的
IP地址
将
公开记录
在
本页的修订历史
中。您如果
登录
或
注册一个帐号
,可以隐藏自己的IP地址并
使用更多功能
。您可以在
您的对话页
查看给您的留言。
任何侵权内容
将会删除 | 百科内容须附有来源,以
供查证
| 维基百科内容均容许他人编辑、使用和重制 | 参阅
繁简
和
地区词处理
指引。
反垃圾检查。
不要
加入这个!
-- This module implements {{Episode table}} and {{Episode table/part}}. -------------------------------------------------------------------------------- -- EpisodeTable class -- The main class. -------------------------------------------------------------------------------- local contrast_ratio = require('Module:Color contrast')._ratio local EpisodeTable = {} function EpisodeTable.cell(background, width, text, reference) local cell = mw.html.create('th') -- Cell cell:attr('scope','col') :css('background',background or '#CCCCFF') :css('width',width ~= '' and width .. '%' or nil) :wikitext(text) -- Reference if reference then cell:wikitext(" " .. EpisodeTable.reference(reference, background)) end return cell end function EpisodeTable.reference(reference, background) local link1_cr = contrast_ratio{'#0645AD', background or '#CCCCFF', ['error'] = 0} local link2_cr = contrast_ratio{'#0B0080', background or '#CCCCFF', ['error'] = 0} local refspan = mw.html.create('span') :wikitext(reference) if link1_cr < 7 or link2_cr < 7 then refspan :css('background-color','white') :css('padding','1px') :css('display','inline-block') :css('line-height','50%') end return tostring(refspan) end function EpisodeTable.abbr(text,title) local abbr = mw.html.create('abbr') :attr('title',title) :wikitext(text) return tostring(abbr) end function EpisodeTable.part(frame,args) local row = mw.html.create('tr') local black_cr = contrast_ratio{args[2], 'black', ['error'] = 0} local white_cr = contrast_ratio{'white', args[2], ['error'] = 0} local displaytext = (not args.nopart and 'Part ' or '') .. (args[1] or '') row:tag('td') :attr('colspan',13) :css('text-align','center') :css('background-color', args[2]) :css('color', black_cr > white_cr and 'black' or 'white') :wikitext("'''" .. frame:expandTemplate({title='Visible anchor',args={displaytext}}) .. "'''" .. (args.r or '')) return tostring(row) end function EpisodeTable.new(args) args = args or {} local categories = '' local background = (args.background and args.background ~= '') and args.background or nil -- Create episode table local root = mw.html.create('table') root :addClass('wikitable') :addClass('wikiepisodetable') :css('width', args.total_width and string.gsub(args.total_width,'%%','') .. '%' or '100%') -- Caption if args.caption then root:tag('caption'):wikitext(args.caption) end -- Colour contrast; add to category only if it's in the mainspace local title = mw.title.getCurrentTitle() local black_cr = contrast_ratio{background, 'black', ['error'] = 0} local white_cr = contrast_ratio{'white', background, ['error'] = 0} if title.namespace == 0 and (args.background and args.background ~= '') and black_cr < 7 and white_cr < 7 then categories = categories .. '[[Category:Articles using Template:Episode table with invalid colour combination]]' end -- Main row local mainRow = root:tag('tr') mainRow :css('color', background and (black_cr > white_cr and 'black' or 'white') or 'black') :css('text-align', 'center') -- Cells do local used_season = false local country = args.country ~= '' and args.country ~= nil local viewers = (country and args.country or '') .. ' ' .. (country and 'v' or 'V') .. 'iewers' .. ((not args.viewers_type or args.viewers_type ~= '') and '<br />(' .. (args.viewers_type or 'millions') .. ')' or '') local cellNames = { {'overall','EpisodeNumber',EpisodeTable.abbr('数','总集数') .. ((args.season or args.series or args.EpisodeNumber2 or args.EpisodeNumber2Series or args.forceoverall) and '<br />overall' or '')}, {'season','EpisodeNumber2','季<br />' .. EpisodeTable.abbr('数','集数')}, {'series','EpisodeNumber2Series','续<br />' .. EpisodeTable.abbr('数','集数')}, {'title','Title','标题'}, {'aux1','Aux1',''}, {'director','DirectedBy','导演'}, {'writer','WrittenBy','编剧'}, {'aux2','Aux2',''}, {'aux3','Aux3',''}, {'airdate','OriginalAirDate',(args.released and '上线' or '首播') .. '日期'}, {'altdate','AltDate',''}, {'prodcode','ProdCode',EpisodeTable.abbr('产','制作') .. '<br />代码'}, {'viewers','Viewers','收视率'}, {'aux4','Aux4',''} } for k,v in pairs(cellNames) do local thisCell = args[v[1]] or args[v[2]] if thisCell and (v[1] ~= 'series' or (v[1] == 'series' and used_season == false)) then if v[1] == 'season' then used_season = true end if (k <= 3 and thisCell == '') then thisCell = '5' end local thisCellT = args[v[1] .. 'T'] or args[v[2] .. 'T'] local thisCellR = args[v[1] .. 'R'] or args[v[2] .. 'R'] mainRow:node(EpisodeTable.cell(background, thisCell, thisCellT or v[3], thisCellR)) end end -- Episodes root:node(args.episodes) end return tostring(root) .. categories end -------------------------------------------------------------------------------- -- Exports -------------------------------------------------------------------------------- local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { removeBlanks = false, wrappers = 'Template:Episode table' }) return EpisodeTable.new(args) end function p.part(frame) local args = require('Module:Arguments').getArgs(frame, { removeBlanks = false, wrappers = 'Template:Episode table/part' }) return EpisodeTable.part(frame,args) end function p.ref(frame) local args = require('Module:Arguments').getArgs(frame, { removeBlanks = false, }) return EpisodeTable.reference(args.r,args.b) end return p
编辑摘要
(请简要描述您所作出的修改
,或选择:
新条目
修饰语句
修正笔误
内容扩充
排版
来源
内部链接
分类
消歧义
维基化
维护清理
)
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
分类索引
特色内容
新闻动态
随机条目
联络我们
关于维基百科
资助维基百科
贡献
帮助
维基社群
编辑入门
互助客栈
IRC即时聊天
最近更改
特殊页面
工具
链入页面
相关更改
特殊页面
页面信息