Modul:he-common

Vikilug‘atdan olingan

Bu modul uchun Modul:he-common/doc nomli hujjat sahifasini yaratishingiz mumkin

local export = {}
local tili = require("Module:tili").getByCode("he")
 
-- A nil-safe, Hebrew-specific diacritic remover.
function export.remove_nikud(formwv)
	return formwv and tili:makeEntryName(formwv)
end
 
-- This should only be used by modules that auto-generate words, otherwise use gen_link
function export.process_wv_triad(form, formwv, formdwv)
	if form then
		return form, formwv, formdwv
	elseif formwv then
		return export.remove_nikud(formwv), formwv, formdwv
	else
		return export.remove_nikud(formdwv), formdwv, nil
	end
end
 
function export.gen_link(form, formwv, formdwv)
	form, formwv, formdwv = export.process_wv_triad(form, formwv, formdwv)
	if not form then
		error("Can't make a link out of nothing.")
	end
	if formdwv then
		return "[[" .. form .. "|" .. (formwv or form) .. " \\ " .. formdwv .. "]]"
	else
		return "[[" .. form .. "|" .. (formwv or form) .. "]]"
	end
end
 
return export