Module:Pending approval:修订间差异
跳转到导航
跳转到搜索
添加的内容 删除的内容
BoredYukolin(留言 | 贡献) (此模块本就应是为易维护性服务的,文档中“以提醒用户不要擅自改动”现状上对维护不再是最主要功能。必要性已经说明,绕过此处则难以用其他方式实现。) 标签:撤销 |
BoredYukolin(留言 | 贡献) 小无编辑摘要 |
||
第42行: | 第42行: | ||
if mw.isSubsting() then |
if mw.isSubsting() then |
||
if entry and entry[2] and entry[3] and entry[4] then |
if entry and entry[2] and entry[3] and entry[4] then |
||
return out( entry[tonumber( args.target or 1 ) + 1] ) |
return out( entry[tonumber( args.target or 1 ) + 1] .. originSuffix ) |
||
else |
else |
||
return '{{pa' .. |
return '{{pa' .. |
2025年4月12日 (六) 12:24的最新版本
此模块用于为{{Pending approval}}
提供功能,具体用法见模板文档。
依赖项
[ 查看 | 编辑 | 历史 | 刷新 ]上述文档引用自Module:Pending approval/doc。
local p = {}
local data = mw.loadData( [[Module:Pending approval/data]] )
local tr = require( [[Module:STConversion]] ).call
local template = [[<span style="opacity: 0.8;" class="explain minetip" title="译名尚未确定,请勿擅自改动">''%s''</span>]]
local convert = '-{%s|%s}-'
function p.pure( s, v )
if v then
return convert:format( v, template:format( s ) )
else
return template:format( s )
end
end
function p.call( args )
local target = ( args[1] or '' ) == '' and mw.title.getCurrentTitle().subpageText or args[1]
local link = args[2]
local entry = data[target]
if entry then
target = entry[1]
end
if link == '' then
if ( args[1] or '' ) == '' then
link = mw.title.getCurrentTitle().fullText
else
link = entry and entry.page or target
end
end
local function out( s )
if not link then
return s
elseif s == link then
return '[[' .. s .. ']]'
else
return '[[' .. link .. '|' .. s .. ']]'
end
end
local paText = template:format( out( target ) )
local originSuffix = args.showorigin and '(' .. target .. ')' or ''
if mw.isSubsting() then
if entry and entry[2] and entry[3] and entry[4] then
return out( entry[tonumber( args.target or 1 ) + 1] .. originSuffix )
else
return '{{pa' ..
( args[1] and ( '|' .. args[1] ) or '' ) ..
( args[2] and ( '|' .. args[2] ) or '' ) ..
'}}'
end
else
local cat = ( mw.title.getCurrentTitle().isContentPage and not args.nocat ) and '[[Category:未确定的译名]]' or ''
if entry then
return tr {
entry[2] and out( entry[2] .. originSuffix ) or convert:format( 'zh-cn', paText ),
entry[3] and out( entry[3] .. originSuffix ) or convert:format( 'zh-tw', paText ),
entry[4] and out( entry[4] .. originSuffix ) or convert:format( 'zh-hk', paText ),
} .. cat
else
return paText .. cat
end
end
end
function p.main( f )
return p.call( f:getParent().args )
end
return p