打开/关闭搜索
搜索
打开/关闭菜单
123
756
151
4.8K
Rizline中文维基
导航
首页
最近更改
随机页面
♪ 随机曲目
MediaWiki帮助
特殊页面
上传文件
项目
方针
格式手册
著作权
帮助
维基入门
基础语法
图像
表格
介绍
机制
设置
活动
收藏
挑战
版本更新概要
列表
曲目列表
插画作者列表
曲目作者列表
Rizcard列表
版式列表
称号列表
成就列表
外部链接
Rizline官方bilibili账号
Rizline中文维基bilibili账号
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
中文(简体)
个人工具
创建账号
登录
查看“︁模块:MsgCell”︁的源代码
来自Rizline中文维基
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:MsgCell
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于这些用户组的用户执行:
管理员
、emailconfirmed
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
-- {{#invoke:MsgCell|func}} local getArgs = require('Module:Arguments').getArgs; local yesno = require('Module:Yesno'); local MsgCell = {} function MsgCell:Create() local Cell = mw.html.create('div'); if self.cellType == 'FmCell' then Cell = Cell:addClass('mw-parser-output') :tag('div');-- 外面套一层mw-p-o,解决TemplateStyle问题 end Cell:addClass('msgCell'):addClass(self.cellType); if self.isSmall then Cell:addClass('smallCell');end if self.class then Cell:addClass(self.class);end if self.style then Cell:cssText(self.style);end if self.bgColor then Cell:css('background-color',self.bgColor);end if self.color then Cell:css('color',self.color);end local image = Cell:tag('div'):addClass('image'); if self.image then local img = self.image; if self.isSpecialImg or img:sub(1,2) == '[[' then image:wikitext(img); else image:wikitext('[[File:' .. img .. '|64px]]') end end if self.imgStyle then image:cssText(self.imgStyle);end if self.imgColor then image:css('background-color',self.imgColor);end local text = Cell:tag('div'):addClass('text'); self.textFunc(text); return tostring(Cell:allDone()); end function MsgCell:Main() -- TODO:Init self.isSmall = yesno(self.Small or self.small or false,false); self.isSpecialImg = yesno(self.specialImg) self.textFunc = function (node) -- class和style就不提供中文版了,别问为啥。 local title = self.title or self['标题'] if self.title then local cnode = node:tag('span'):addClass('title'):wikitext(title); local claxx = self.titleClass; if claxx then cnode:addClass(claxx);end local style = self.titleStyle; if style then cnode:cssText(style);end end local text = self.text or self['正文'] if self.text then local cnode = node:tag('span'):addClass('text'):wikitext(text); local claxx = self.textClass; if claxx then cnode:addClass(claxx);end local style = self.textStyle; if style then cnode:cssText(style);end else error('缺失参数:text!') end local ptext = self.postscript or self['附言'] if self.title then local cnode = node:tag('span'):addClass('ptext'):wikitext(ptext); local claxx = self.postClass; if claxx then cnode:addClass(claxx);end local style = self.postStyle; if style then cnode:cssText(style);end end end return MsgCell.Create(self); end local p = setmetatable({},{ __index = function (t, k) local rtnFunc = function(templateFrame) local tab = getArgs(templateFrame); tab.cellType = k; tab.frame = templateFrame; return MsgCell.Main(tab) end rawset(t,k,rtnFunc) return rtnFunc; end }); function p.Test(args) args.frame = mw.getCurrentFrame(); mw.log(MsgCell.Main(args)); end return p;
该页面使用的模板:
模块:MsgCell/doc
(
查看源代码
)
返回
模块:MsgCell
。