Module:R:LBG

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.

This module is invoked by {{R:LBG}}.


local export = {}

local tag_greek = require("Module:grc-utilities").tag

local function load_data(w)
    --return mw.loadData("Module:R:LBG/data")[w]
	return require("Module:data tables").index_table("grc_RLBG_lemma_to_index", w)
end

function export.index(frame)
	local params = {
		w = {default = mw.title.getCurrentTitle().text},
		[1] = {},
		[2] = {alias_of = "w"},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local title = args.w
	local tagged_title = tag_greek(title)
	local number = args[1]
	
	if number then
		return ("[http://stephanus.tlg.uci.edu/lbg/#eid="..number.."&context=lsj "..tagged_title.."] in ")
	else
		local n = load_data(title)
		if n then
			return ("[http://stephanus.tlg.uci.edu/lbg/#eid="..n[1].."&context=lsj "..tagged_title.."] in ")
		else
			return ""
		end
	end
end

return export