编辑“︁
Module:LinkTools
”︁
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
local p={} --{{#invoke:LinkTools|navRedirect}} function p.navRedirect(frame) local args, working_frame if frame == mw.getCurrentFrame() then -- We're being called via #invoke. The args are passed through to the module -- from the template page, so use the args that were passed into the template. args = frame.args working_frame = frame else -- We're being called from another module or from the debug console, so assume -- the args are passed in directly. args = frame working_frame = mw.getCurrentFrame() if type(args) ~= type({}) then args = {frame} end end local title = mw.text.trim(args[1] or args['1'] or '') local display = mw.text.trim(args[2] or args['2'] or '') local title_obj = mw.title.new(title) local title_target = title_obj local section = '' local title_sp = mw.text.trim(mw.ustring.sub(title, (({mw.ustring.find(title, '#')})[1]or 0)+1, -1) or '') if title_obj then if title_obj.isRedirect then title_target = title_obj.redirectTarget end if mw.text.trim(display) == '' then display = ((mw.text.trim(title_sp) == '') and title or title_sp) end section = mw.text.trim(title_target.fragment or '') local cur_title = mw.title.getCurrentTitle() if (cur_title.namespace == title_target.namespace) and (cur_title.text == title_target.text)then local section_text = '' local section_name = mw.text.trim(title_target.fragment or '') if section_name ~= '' then section_text = "([[#" .. section_name .. "|章節]])" end return "'''"..display.."'''"..section_text end return "[["..title.."|"..display.."]]" else return '' end end function p.loadpage(page) local page_name = page if type(page) == type({}) then page_name = (page.args or page)[1] elseif type(page) == type(nil) then return '' elseif type(page) ~= type("string") then page_name = tostring(page) end page_name = tostring(page_name or '') if mw.text.trim(page_name) ~= '' then local title_obj = mw.title.new(page_name) pcall(title_obj.getContent, title_obj) end return '' end function p.linkExist(_title) local title = _title if type(_title) == type(0) then title = tostring(_title) elseif type(_title.args) == type({"table"}) then title = _title.args[1] or _title.args['1'] or '' elseif type(_title) == type({"table"}) then title = _title[1] or _title['1'] or '' end local number = tonumber(title) if number then if number >= -1 and number <= 101 then return ("[[%d]]"):format(number) end end local titleObj = mw.title.new(title) if titleObj then if titleObj:getContent() then local target = titleObj.redirectTarget or titleObj return ("[[%s]]"):format(title) end end return title end function p.linkExistNotDisambig(_title) local lib_pjc = require("Module:PJBSClass/main") local title = _title if type(_title) == type(0) then title = tostring(_title) elseif type(_title.args) == type({"table"}) then title = _title.args[1] or _title.args['1'] or '' elseif type(_title) == type({"table"}) then title = _title[1] or _title['1'] or '' end local number = tonumber(title) if number then if number >= -1 and number <= 101 then return ("[[%d]]"):format(number) end end local titleObj = mw.title.new(title) if titleObj then if titleObj:getContent() then local target = titleObj.redirectTarget or titleObj if lib_pjc.is_disambiguation(target.fullText) then return title else return ("[[%s]]"):format(title) end end end return title end return p
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息