मॉड्यूल:sa-correlatives
दिखावट
इस मॉड्यूल हेतु प्रलेख मॉड्यूल:sa-correlatives/doc पर बनाया जा सकता है
local export = {}
local function make_edit_link(title)
local URL = tostring(mw.uri.fullUrl(title, "action=edit"))
return '<span class="plainlinks">[' .. URL .. ' edit]</span>'
end
-- Here, anything in template parameter notation, {{{thingy}}}, will be linked
-- with no transliteration, like {{l|sa|thingy|tr=-}}.
local template =
[=[
<div class="NavFrame">
<div class="NavHead" align="left">[[Appendix:Sanskrit correlatives|Sanskrit correlatives]] <sup>(]=] .. make_edit_link("Module:sa-correlatives") .. [=[)</sup></div>
<div class="NavContent" align="center">
{| class="wikitable"
!type !! interrogative !! indefinite !! collective !! proximal<br />demonstrative !! distal<br />demonstrative !! relative !! identity !! other
|-
!basic
}</div></div>]=]
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 '[[' .. entry_name .. '#Ancient Greek|' .. text .. ']]'
else
return '<strong class="selflink">' .. text .. '</strong>'
end
end
end
local function tag(text)
return '<span class="polytonic" lang="grc">' .. link_or_not(text) .. '</span>'
end
return (template:gsub('{{{([^}]+)}}}', tag))
end
return export