Module:Redirect:修订间差异
删除的内容 添加的内容
基于 zhwiki 版,支持中文 #重定向 和 Scribunto 模块重定向 |
拉取适配 zhwiki hatnote 体系模块(原版,仅适配 Wikipedia 链接) |
||
第1行:
-- This module provides functions for getting the target of a redirect page.
local p = {}
第36行 ⟶ 第35行:
return string.match(
text,
"^%s*return%s+require%s*%[%[([^%[%]|]-)%]%]" -- T120794
) or string.match(
text,
第65行 ⟶ 第64行:
return nil
end
-- Find the target by using string matching on the page content.
local target = p.getTargetFromText(titleObj:getContent() or "", titleObj.contentModel)
--優先使用原本的判斷方式,如果判斷不出來,再直接用redirectTarget
or titleObj.redirectTarget
if target then
第81行:
end
else
-- The page is a redirect, but matching failed. This indicates a bug in
-- the redirect matching pattern, so throw an error.
error(string.format(
'无法处理页面"%s"上的重定向',
第92行 ⟶ 第94行:
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
| |||