跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
社群首页
帮助
希顶相关网站
希顶社区官网
(原作)希顶翻译器
〇改希顶转写器
希顶模组服务器
搜索
搜索
创建账号
登录
个人工具
创建账号
登录
查看“Module:ReplacePlus”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
←
Module:ReplacePlus
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于这些用户组的用户执行:
用户
、storagereadable
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local module = {} local getArgs = require('Module:Arguments').getArgs function _main(args, frame) local str = args['str'] or args[1] or '' local ptn = args['ptn'] or args[2] or '' ptn = mw.text.decode(mw.text.unstripNoWiki(ptn)) local replace = args['rep'] or args[3] or '' local split = args['spl'] or args[4] or '、' local limit = args['lim'] or args[5] or 'false' local origin = tonumber(args['ori'] or args[6] or 1) local noprint = args['noprint'] or false str = mw.ustring.sub(str, origin) local captures = {} local result, count = '' if string.find(limit, '%d+') then limit = tonumber(limit) result, count = mw.ustring.gsub(str, ptn, function(s) captures[#captures + 1] = s return s end, limit) result = mw.ustring.gsub(str, ptn, replace, limit) else result, count = mw.ustring.gsub(str, ptn, function(s) captures[#captures + 1] = s return s end) result = mw.ustring.gsub(str, ptn, replace) end frame:callParserFunction('#vardefine', 'result.capture', table.concat(captures, split)) frame:callParserFunction('#vardefine', 'result.count', count) if noprint ~= 'true' then return result else frame:callParserFunction('#vardefine', 'result', result) return '' end end function module.main(frame) local args = getArgs(frame) return _main(args, frame) end function module.multi(frame) local args = getArgs(frame, { warppers = 'Template:Str_replace_multi' } ) local text = args[1] or '' local done = {} if args[2] then local sort = mw.text.split(mw.ustring.gsub(args[2], '|+', '|'), '|') while sort[#sort] == '' do table.remove(sort, #sort) end for _, key in ipairs(sort) do if key ~= 1 and key ~= 2 then text = mw.ustring.gsub(text, key, args[key]) end done[key] = true end end -- 允许对顺序不依赖的情况直接使用模块 for key, val in pairs(args) do if not done[key] and key ~= 1 and key ~= 2 then text = mw.ustring.gsub(text, key, val) end end return text end function module.tran(frame) local args = getArgs(frame) local text = args[1] local done = {} local keyu={"⇧","⇩","1_`","2_`","3_`","4_`","5_`","6_`","7_`","8_`","9_`","0_`","T_`","n_`","火糸","纟火","糹火","疒开","纟华","糹華","纟太","糹太","品乙","衤尹","衤壹","\\^!","\\^b","\\^p","\\^m","\\^w","\\^j","\\^q","\\^x","\\^y","\\^n","\\^z","\\^D","\\^s","\\^r","\\^H","\\^N","~!","~b","~p","~m","~w","~j","~q","~x","~y","~n","~z","~D","~s","~r","~H","~N","\\^l","\\^d","\\^t","\\^g","\\^k","\\^h","\\^4","\\^5","\\^v","\\^F","\\^7","\\^B","\\^c","\\^f","\\^u","\\^a","~l","~d","~t","~g","~k","~h","~4","~5","~v","~F","~7","~B","~c","~f","~u","~a","\\^o","\\^e","\\^E","\\^A","\\^Y","\\^L","\\^6","\\^2","\\^T","\\^8","\\^3","\\^V","\\^1","\\^i","\\^X","\\^9","~o","~e","~E","~A","~Y","~L","~6","~2","~T","~8","~3","~V","~1","~i","~X","~9","\\^W","\\^P","\\^J","\\^U","\\^R","\\^Z","\\^O","\\^0","\\^K","\\^Q","\\^G","\\^I","\\^S","\\^M","\\^C","\\^s`","~W","~P","~J","~U","~R","~Z","~O","~0","~K","~Q","~G","~I","~S","~M","~C","~s`","\\^r`","\\^P`","\\^R`","\\^Q`","\\^k`","\\^8`","\\^5`","\\^m`","\\^w`","\\^Y`","\\^a`","\\^N`","\\^x`","\\^O`","\\^C`","\\^q`","~r`","~P`","~R`","~Q`","~k`","~8`","~5`","~m`","~w`","~Y`","~a`","~N`","~x`","~O`","~C`","~q`","\\^g`","\\^v`","\\^L`","\\^p`","\\^6`","\\^$`","\\^?`","\\^W`","\\^n`","~g`","~v`","~L`","~p`","~6`","~$`","~?`","~W`","~n`","!","b","p","m","w","j","q","x","y","n","z","D","s","r","H","N","l","d","t","g","k","h","4","5","v","F","7","B","c","f","u","a","o","e","E","A","Y","L","6","2","T","8","3","V","1","i","X","9","W","P","J","U","R","Z","O","0","K","Q","G","I","S","M","C","s`","r`","P`","R`","Q`","k`","8`","5`","m`","w`","Y`","a`","N`","x`","O`","C`","q`","g`","v`","L`","p`","6`","$`","?`","W`","n`"} local valu={"\\^","~","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""} for i=1,#keyu do text = mw.ustring.gsub(text, keyu[i], valu[i]) end return text end return module
该页面使用的模板:
Module:ReplacePlus/doc
(
查看源代码
)
返回
Module:ReplacePlus
。
开关有限宽度模式