模組:R:it:Treccani

維基詞典,自由的多語言詞典

此模块實現了參考模板 {{R:it:Treccani}}


local exports = {}

function exports.create(frame) 
	 local params = {
		[1] = {default = mw.title.getCurrentTitle().text},
		[2] = {},
		["sense"] = {},
		["accessdate"] = {},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local strippedTerm = mw.ustring.toNFD(args[1])
			:gsub("[\204\128-\205\175]", "")  -- strip combining diacritical marks, U+0300-U+036F
			:gsub(' ', '-')
	local encodedTerm = mw.uri.encode(strippedTerm) 
	local sense = args["sense"] or ''
	
	if sense ~= '' then
		encodedTerm = encodedTerm .. sense
	end
	local title = (args[2] or args[1]):gsub('_', ' ')
    
    local link = "[https://www.treccani.it/vocabolario/" .. encodedTerm .. " " .. title
    	.. (sense and ('<sup>' .. sense .. '</sup>') or '')
    	.. "] " ..
    	"在Treccani.it – ''Vocabolario Treccani on line'', Istituto dell'Enciclopedia Italiana" 

	return link
end

return exports