Module:R:jam:Jamaicans

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module implements {{R:jam:Jamaicans}}.


local exports = {}

local lang = require("Module:languages").getByCode("jam")
local PAGENAME = mw.title.getCurrentTitle().text

-- The main entry point.
-- This is the only function that can be invoked from a template.
function exports.create(frame) 
    
    local query = PAGENAME
    local strippedTerm = mw.ustring.toNFD(query)
        :gsub("[\204\128-\205\175]", "")  -- strip combining diacritical marks, U+0300-U+036F
        :gsub(' ', '-')
	local encodedTerm = mw.uri.encode(strippedTerm) .. ".html"
	local title = query
    
    -- see https://en.wiktionary.org/wiki/Wiktionary:References
    local output = "[https://web.archive.org/web/https://jamaicans.com/dictionary/" .. encodedTerm .. " " .. title .. "] " ..
        "– jamaicans.com Jamaican Patois dictionary"

    return output
end

return exports