跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
社群首页
帮助
希顶相关网站
希顶社区官网
(原作)希顶翻译器
〇改希顶转写器
希顶模组服务器
搜索
搜索
创建账号
登录
个人工具
创建账号
登录
查看“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={"^","~","\ue001","\ue002","\ue003","\ue004","\ue005","\ue006","\ue007","\ue008","\ue009","\ue00a","\ue00b","\ue00c","\ue015","\ue016","\ue017","\ue018","\ue019","\ue01a","\ue01b","\ue01c","\ue01d","\ue01e","\ue01f","\ue020","\ue021","\ue022","\ue023","\ue024","\ue025","\ue026","\ue027","\ue028","\ue029","\ue02a","\ue02b","\ue02c","\ue02d","\ue02e","\ue02f","\ue040","\ue041","\ue042","\ue043","\ue044","\ue045","\ue046","\ue047","\ue048","\ue049","\ue04a","\ue04b","\ue04c","\ue04d","\ue04e","\ue04f","\ue050","\ue051","\ue052","\ue053","\ue054","\ue055","\ue056","\ue057","\ue058","\ue059","\ue05a","\ue05b","\ue05c","\ue05d","\ue05e","\ue05f","\ue070","\ue071","\ue072","\ue073","\ue074","\ue075","\ue076","\ue077","\ue078","\ue079","\ue07a","\ue07b","\ue07c","\ue07d","\ue07e","\ue07f","\ue080","\ue081","\ue082","\ue083","\ue084","\ue085","\ue086","\ue087","\ue088","\ue089","\ue08a","\ue08b","\ue08c","\ue08d","\ue08e","\ue08f","\ue0a0","\ue0a1","\ue0a2","\ue0a3","\ue0a4","\ue0a5","\ue0a6","\ue0a7","\ue0a8","\ue0a9","\ue0aa","\ue0ab","\ue0ac","\ue0ad","\ue0ae","\ue0af","\ue0b0","\ue0b1","\ue0b2","\ue0b3","\ue0b4","\ue0b5","\ue0b6","\ue0b7","\ue0b8","\ue0b9","\ue0ba","\ue0bb","\ue0bc","\ue0bd","\ue0be","\ue0bf","\ue0d0","\ue0d1","\ue0d2","\ue0d3","\ue0d4","\ue0d5","\ue0d6","\ue0d7","\ue0d8","\ue0d9","\ue0da","\ue0db","\ue0dc","\ue0dd","\ue0de","\ue0df","\ue0e0","\ue0e1","\ue0e2","\ue0e3","\ue0e4","\ue0e5","\ue0e6","\ue0e7","\ue0e8","\ue0e9","\ue0ea","\ue0eb","\ue0ec","\ue0ed","\ue0ee","\ue0ef","\ue100","\ue101","\ue102","\ue103","\ue104","\ue105","\ue106","\ue107","\ue108","\ue109","\ue10a","\ue10b","\ue10c","\ue10d","\ue10e","\ue10f","\ue110","\ue111","\ue112","\ue113","\ue114","\ue115","\ue116","\ue117","\ue118","\ue130","\ue131","\ue132","\ue133","\ue134","\ue135","\ue136","\ue137","\ue138","\ue030","\ue031","\ue032","\ue033","\ue034","\ue035","\ue036","\ue037","\ue038","\ue039","\ue03a","\ue03b","\ue03c","\ue03d","\ue03e","\ue03f","\ue060","\ue061","\ue062","\ue063","\ue064","\ue065","\ue066","\ue067","\ue068","\ue069","\ue06a","\ue06b","\ue06c","\ue06d","\ue06e","\ue06f","\ue090","\ue091","\ue092","\ue093","\ue094","\ue095","\ue096","\ue097","\ue098","\ue099","\ue09a","\ue09b","\ue09c","\ue09d","\ue09e","\ue09f","\ue0c0","\ue0c1","\ue0c2","\ue0c3","\ue0c4","\ue0c5","\ue0c6","\ue0c7","\ue0c8","\ue0c9","\ue0ca","\ue0cb","\ue0cc","\ue0cd","\ue0ce","\ue0cf","\ue0f0","\ue0f1","\ue0f2","\ue0f3","\ue0f4","\ue0f5","\ue0f6","\ue0f7","\ue0f8","\ue0f9","\ue0fa","\ue0fb","\ue0fc","\ue0fd","\ue0fe","\ue0ff","\ue120","\ue121","\ue122","\ue123","\ue124","\ue125","\ue126","\ue127","\ue128"} 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
。
开关有限宽度模式