模块:Direct link
来自星露谷物语扩展百科
更多操作
此模块用于实现{{Direct link}}。
[ 查看 | 编辑 | 历史 | 刷新 ]上述文档的内容来自模块:Direct link/doc。
local p = {}
function p.call( inputArgs )
if not inputArgs or type( inputArgs ) ~= 'table' then
return nil
end
local page = inputArgs[ 1 ] or ''
local text = inputArgs[ 2 ] or ''
if page == '' then
return ''
end
if text == '' then
text = page
end
local linkTargetObject = mw.title.new( page )
if not linkTargetObject then
return ''
end
return '<span class="plainlinks">[' .. linkTargetObject:fullUrl() .. ' ' .. text .. ']</span>'
end
function p.main( f )
local args = f
local frame = mw.getCurrentFrame()
if f == frame then
args = require( 'Module:ProcessArgs' ).merge( true )
end
return p.call{ args[ 1 ] or '', args[ 2 ] or '' }
end
return p