跳转到内容

模組:Fullurl

本页使用了标题或全文手工转换
被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由SunAfterRain留言 | 贡献2019年9月28日 (六) 00:24编辑。这可能和当前版本存在着巨大的差异。

local fullurl = {}
local yesno = require('Module:Yesno')
local mError = require('Module:Error').error

function fullurl.fullurl(frame)
	local args = {}
	for k, v in pairs( frame:getParent().args ) do
		args[k] = v
	end
	local paid = ''
	local title = args['title'] or args[1] or args['1'] or tostring(mw.title.getCurrentTitle())
	local text = args['text'] or args[2] or args['1'] or title
	for k, v in pairs( args ) do
		if ((k == 'title')or (k == 1) or (k == '1')  or (k == 'text') or (k == 2) or (k == '2') or (k == 'onlyurl')) then
		else
			paid = paid .. '&' .. k .. '=' .. v
		end
	end
    local url = tostring(mw.uri.fullUrl(title,paid))
    	  url.plainlinks = '<span class="plainlinks">[' .. url .. ' ' .. text .. ']</span>'
    if (args['action'] == 'submit') then
    	return url.plainlinks .. mError{'[[Module:Fullur]]錯誤:<code>|action=submin</code>不是有效的值,請使用<code>|action=edit</code>。'}
    else
    	if yesno(args['onlyurl']) then
    		return url
    	else
    		return url.plainlinks
    	end
    end
end

return fullurl