Module:sa-correlatives

local export = {}

local function make_edit_link(title) local URL = tostring(mw.uri.fullUrl(title, "action=edit")) return ' [' .. URL .. ' edit] ' end

-- Here, anything in template parameter notation,, will be linked -- with no transliteration, like. local template = [=[ Sanskrit correlatives (]=] .. make_edit_link("Module:sa-correlatives") .. [=[) {| class="wikitable" !type !! interrogative !! indefinite !! collective !! proximal demonstrative !! distal demonstrative !! relative !! identity !! other !basic } ]=]

function export.show(frame) if next(frame.args) then error("This module function does not require any parameters.") end local ugsub, decompose, U = mw.ustring.gsub, mw.ustring.toNFD, mw.ustring.char local macron = U(0x304) local breve = U(0x306) local function make_entry_name(text) text = ugsub(decompose(text), "[" .. macron .. breve .. "]", "") return text end local title = decompose(mw.title.getCurrentTitle.text) local function link_or_not(text) if text:find("", 1, true) then			return text:gsub("%[%[([^%+)%]%]", link_or_not) else local entry_name = make_entry_name(text) if entry_name ~= title then return  .. text ..  else return ' ' .. text .. ' '			end end end local function tag(text) return ' ' .. link_or_not(text) .. ' '	end return (template:gsub('}', tag)) end

return export