Documentation for this module may be created at မဝ်ဂျူ:R:Strong's/doc

local export = {}

function is_polytonic(txt)
	return require("Module:scripts").findBestScript(txt, require("Module:languages").getByCode("grc")):getCode() == "polytonic"
end


function export.strongs(frame)
	local m_scripts = require("Module:scripts")
	local he = require("Module:languages").getByCode("he")
	local grc = require("Module:languages").getByCode("grc")
	
	local args = frame:getParent().args
	local title = args['w'] or mw.title.getCurrentTitle().text
	local title_span = is_polytonic(title) and '<span class="polytonic" lang="grc">'..title..'</span>' or title

	if  mw.title.getCurrentTitle().nsText == "Template" then
		-- pass
	elseif m_scripts.findBestScript(title, he):getCode() == "Hebr" then
		error('Arguments for language and Strong’s Number are required for Hebrew word disambiguation.')
	elseif m_scripts.findBestScript(title, grc):getCode() == "polytonic" then
		local strongs_concordance_numbers_G = require("Module:R:Strong's/grc-data-text-format")
		local number = tonumber(strongs_concordance_numbers_G:match(
			"%f[^%z\n]" .. require "Module:utilities".pattern_escape(title) .. "\t(%d+)%f[%z\n]"))
		if number then
			return "G" .. number
		else
			error('The term “' .. title .. '” does not have a Strong’s number.')
		end
	else
		error('The term “' .. title .. '” is not in polytonic or Hebrew script.')
	end
end

return export