Module:Pi-headword
local export = {}
local pos_functions = {}
local links = require('Module:links')
local labels = require('Module:labels')
local lang = require('Module:languages').getByCode('pi')
local PAGENAME = mw.title.getCurrentTitle().text
local currentScript = require('Module:scripts').findBestScript(PAGENAME, lang)
local translit = require('Module:pi-Latn-translit').tr
local Array = require "Module:array"
function export.alt(frame)
local args = frame:getParent().args
local currentScriptCode = currentScript:getCode()
local availableScripts = lang:getScripts()
local latinForm = args['Latn'] or currentScriptCode == 'Latn' and PAGENAME or error('No Latin-script form detected.')
local scriptCode
local terms
local first
local output = Array('<div class="NavFrame" style="max-width:40em"><div class="NavHead" style="background:#d9ebff">Alternative forms</div><div class="NavContent" style="text-align:left"><ul>')
for _, script in ipairs(availableScripts) do
scriptCode = script:getCode()
terms = { args[scriptCode], args[scriptCode..'2'], args[scriptCode..'3'], args[scriptCode..'4'] }
output:insert('<li>')
local t1, t2, t3
t1 = translit(latinForm, scriptCode) -- not affect Latn itself
if scriptCode == 'Thai' or scriptCode == 'Laoo' then
t2 = translit(latinForm, scriptCode, {impl='no'})
end
-- For Lao script without implicit vowels, 'y' can also be 'ຢ', but seemingly
-- not if a Buddhist Institute consonant is used.
if scriptCode == 'Laoo' then
if not mw.ustring.find(t2, '[ຆຌຏຐຑຒຓຘຠຨຩ]') then
t3 = mw.ustring.gsub(t2, 'ຍ', 'ຢ')
end
end
if #terms == 0 then
terms[1] = t1
if t2 and t1 ~= t2 then terms[2] = t2 end
if t3 and (t2 ~= t3) then table.insert(terms, t3) end
elseif terms[1] ~= t1 then
output:insert('[[Category:Pali terms with inconsistent transliterations]]')
end
first = true
for _,term in ipairs(terms) do
if term ~= nil and term ~= PAGENAME then
if first then
output:insert(links.full_link({lang = lang, sc = script, term = term}))
first = false
else
output:insert(' or ' .. links.full_link({lang = lang, sc = script, term = term}))
end
end
end
if scriptCode ~= currentScriptCode or #terms > 1 then
output:insert(' ' .. labels.show_labels({ script:getCategoryName() }, lang) .. '</li>')
end
end
output:insert('</ul></div></div>')
return output:concat()
end
function export.show(frame)
local args = require('Module:parameters').process(frame:getParent().args,{
[1] = {default = '?'},
["g2"] = {},
['head'] = {},
})
local poscat = frame.args[1] or error('Part of speech has not been specified. Please pass parameter 1 to the module invocation.')
local data = {lang = lang, sc = currentScript, pos_category = poscat, categories = {'Pali ' .. poscat .. ' in ' .. currentScript:getCategoryName()}, heads = {args['head'] or PAGENAME}, genders = {}, inflections = {}}
if poscat == 'nouns' or poscat == 'proper nouns' or poscat == 'pronouns' then
table.insert(data.genders, args[1])
table.insert(data.genders, args["g2"])
end
if poscat == 'verbs' then
table.insert(data.inflections, {label = 'root', args[1]})
end
return require('Module:headword').full_headword(data)
end
return export
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.