搜索
登录
↓
个人工具
创建账户
登录
导航菜单
导航
目录
导航
首页
最近更改
随机页面
特殊页面
帮助
新增条目请求
编辑说明与规范
模板与编辑代码
测试沙盒
分类
原作漫画
电视动画
剧场版
其他
关于
关于百科
查看“模块:Plain text”的源代码
来自柯南百科
←
模块:Plain text
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
编辑
您必须确认您的电子邮件地址才能编辑页面。请通过
系统设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar" --removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup local p = {} function p.main(frame) local text = frame.args[1] return p._main(text) end function p._main(text) if not text then return end text = mw.text.killMarkers(text) :gsub(' ', ' ') --replace nbsp spaces with regular spaces :gsub('<br ?/?>', ', ') --replace br with commas :gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside :gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside :gsub('<.->.-<.->', '') --strip out remaining tags and the text inside :gsub('<.->', '') --remove any other tag markup :gsub('%[%[%s*[Ff]ile%s*:.-%]%]', '') --strip out files :gsub('%[%[%s*[Ii]mage%s*:.-%]%]', '') --strip out use of image: :gsub('%[%[%s*[Cc]ategory%s*:.-%]%]', '') --strip out categories :gsub('%[%[[^%]]-|', '') --strip out piped link text :gsub('[%[%]]', '') --then strip out remaining [ and ] :gsub("'''''", "") --strip out bold italic markup :gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes :gsub('----', '') --remove ---- lines :gsub("^%s+", "") --strip leading :gsub("%s+$", "") --and trailing spaces :gsub("%s+", " ") --strip redundant spaces return text end return p
该页面使用的模板:
模块:Plain text/doc
(
查看源代码
)
返回至
模块:Plain text
。