Module:R:NLW

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

--There are a small number (thirteen) of occurrences of the letter v in NLW: 
--[('cahvva', '0/001964'), ('controversatrix', '2/014054'), ('frivolarius', '2/014562'), ('inconvenit', '2/014442'), ('Livonista', '2/016294'), ('novercus', '3/018755'), ('revalidatio', '1/014169'), ('semielevatus', '0/018872'), ('silvecula', '2/018654'), ('subtervallo', '2/019886'), ('suspensive', '3/018407'), ('Zvvinglice', '1/016721'), ('Zvvinglicola', '1/007593')]
--These are simply omitted from this index.

function export.index(frame)
	local args = frame:getParent().args
	local w = args[1] or mw.title.getCurrentTitle().text
	local w0 = string.gsub(string.gsub(string.gsub(string.gsub(w, "v", "u"), "V", "U"), "j", "i"), "J", "i")
    if (not args[1] or args[1] == "") and mw.title.getCurrentTitle().nsText == "Template" then
		return ""
	else
		local datW = require("Module:data tables").index_table("la_NLW_headwords_to_path", w)
		local datW0 = require("Module:data tables").index_table("la_NLW_headwords_to_path", w0)
		local hws = datW and datW[1] or datW0 and datW0[1] or nil
		local u = (args[2] or hws) and "http://www.neulatein.de/words/start2.htm?../words/"..(args[2] or hws)..".htm " or nil
		return u and ("["..u.." "..w..'] in ') or ""
	end
end

--note: the reason to include July 2016 as the default retrieval date is that 
--this website is regularly updated, and the headwords in Module:R:NLW/headwords
--were retrieved on this date.  The default date should be updated at the same
--time as the headwords list, and the citation should be altered to a book
--citation at the time of publication.
function export.format_date(frame)
	return frame:getParent().args[3] or "16 July 2016"
end



return export