Module:senseno

Hello, you have come here looking for the meaning of the word Module:senseno. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:senseno, but we will also tell you about its etymology, its characteristics and you will know how to say Module:senseno in singular and plural. Everything you need to know about the word Module:senseno you have here. The definition of the word Module:senseno will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:senseno, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


-- Based on ]

local export = {}

local pattern_escape = require("Module:string utilities").pattern_escape
local unpack = unpack or table.unpack -- Lua 5.2 compatibility

local function list_index(wikitext, t_start)
	local text = wikitext:sub(1, t_start)
	local _, section_start = text:find(".*\n==")
	text = text:sub(section_start)

	local lines = mw.ustring.gmatch(text, "\n#*")
	local senseno = {}
	line = lines()
	while line ~= nil do
		if line:find(":") or line:find("%*") then
			-- skip
		else
			line = line:match("#+")
			local indentation = #line
			if indentation > #senseno then
				table.insert(senseno, 1)
			else
				senseno = {unpack(senseno, 1, indentation)}
				senseno = senseno + 1
			end
		end

		line = lines()
	end

	return senseno
end

local function find_senseid(title, code, id)
	local content = mw.title.new(title):getContent()
	local t_start = ""
	
	t_start = content:find("%{%{ *senseid *%| *" .. pattern_escape(code) .. " *%| *" .. pattern_escape(id) .. " *%}%}")
	
	if t_start == nil then
		t_start = content:find("%{%{ *sid *%| *" .. pattern_escape(code) .. " *%| *" .. pattern_escape(id) .. " *%}%}")
	end
	
	if t_start == nil then
		error("Could not find the correct senseid template in the entry [["
		.. title .. "]] (with language " .. code .. " and id '" .. id .. "'); this could be because you are in preview mode and the senseid template has not yet been saved to the page")
	end
	
	return table.concat(list_index(content, t_start), ".")
end

function export.main(frame)
    local args = frame.args
    local code = args
    local id = args
    local title = args
    title = args

	return find_senseid(title, code, id)
end

return export