Module:syllables: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 1: Line 1:
local export = {}
local export = {}


function export.show(frame)
local m_languages = require("Module:languages")
local args = frame:getParent().args
local m_parameters = require("Module:parameters")
local language = args[1]
local params = {
local syllables = {}
[1] = {required = true},
local i = 2
[2] = {list = true},
while args[i] do
["caption"] = {},
if args[i] ~= "" then table.insert(syllables, args[i]) end
}
 
function export.make_syllables(language, caption, list)
local syllables = ""
local i = 1
local n_i = 1
while list[i] do
if list[i] == "" then
syllables = syllables .. ", "
n_i = 1
else
if n_i > 1 then syllables = syllables .. "·" end
syllables = syllables .. list[i]
n_i = n_i + 1
end
i = i + 1
i = i + 1
end
end
if #syllables > 0 then
return caption .. ': <span style="font-size:110%;">' .. syllables .. '</span>'
return 'Syllabification: <span style="font-size:110%;">' .. table.concat(syllables, "·") .. '</span>'
end
end
 
error("no syllables given to {{syllables}}")
function export.show_syllables(frame)
local args = m_parameters.process(frame:getParent().args, params)
return export.make_syllables(m_languages.get_by_code(args[1]), args["caption"] or "Syllabification", args[2])
end
 
function export.show_hyphens(frame)
local args = m_parameters.process(frame:getParent().args, params)
return export.make_syllables(m_languages.get_by_code(args[1]), args["caption"] or "Hyphenation", args[2])
end
end


return export
return export

Navigation menu