Module:siwa-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 10: Line 10:
local u = mw.ustring.char
local u = mw.ustring.char
local split = mw.text.split
local split = mw.text.split
local gsplit = mw.text.gsplit


local export = {}
local export = {}
Line 240: Line 241:
table.insert(full_pronunciations, format_IPA(IPA_args))
table.insert(full_pronunciations, format_IPA(IPA_args))
return "(''" .. table.concat(dialect, ", ") .. "'')" .. ' ' .. table.concat(full_pronunciations, ' or ')
return "(''" .. table.concat(dialect, ", ") .. "'')" .. ' ' .. table.concat(full_pronunciations, ' or ')
end
function separate_word(term, a, e, w)
local result = {}
for word in mw.text.gsplit(term, " ") do
table.insert(result, crux(term, a, e, w))
end
return table.concat(result, " ")
end
end


Line 257: Line 268:
if detect_dialect(term) == "e" then
if detect_dialect(term) == "e" then
ipa = ipa .. line_format(export.crux(term, false, true, false), {'Eastern'})
ipa = ipa .. line_format(separate_word(term, false, true, false), {'Eastern'})
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
table.insert(categories, "Eastern Siwa lemmas")
table.insert(categories, "Eastern Siwa lemmas")
Line 263: Line 274:
end
end
elseif detect_dialect(term) == "w" then
elseif detect_dialect(term) == "w" then
ipa = ipa .. line_format(export.crux(term, false, false, true), {'Western'})
ipa = ipa .. line_format(separate_word(term, false, false, true), {'Western'})
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
table.insert(categories, "Western Siwa lemmas")
table.insert(categories, "Western Siwa lemmas")
Line 269: Line 280:
end
end
elseif args.a then
elseif args.a then
ipa = ipa .. line_format(export.crux(term, true, false, false), {'Aingo'})
ipa = ipa .. line_format(separate_word(term, true, false, false), {'Aingo'})
end
end
if args.e then
if args.e then
if export.crux(term, true, false, false) ~= export.crux(term, false, true, false) then
if separate_word(term, true, false, false) ~= separate_word(term, false, true, false) then
if args.a  then
if args.a  then
ipa = ipa .. "\n* "
ipa = ipa .. "\n* "
end
end
ipa = ipa .. line_format(export.crux(term, true, true, false), {'Eastern'})
ipa = ipa .. line_format(separate_word(term, true, true, false), {'Eastern'})
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
table.insert(categories, "Siwa lemmas with Eastern IPA pronunciation")
table.insert(categories, "Siwa lemmas with Eastern IPA pronunciation")
Line 285: Line 296:
if args.w then
if args.w then
if export.crux(term, true, false, false) ~= export.crux(term, false, false, true) then
if separate_word(term, true, false, false) ~= separate_word(term, false, false, true) then
if args.a or args.e then
if args.a or args.e then
ipa = ipa .. "\n* "
ipa = ipa .. "\n* "
end
end
ipa = ipa .. line_format(export.crux(term, true, false, true), {'Western'})
ipa = ipa .. line_format(separate_word(term, true, false, true), {'Western'})
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
if mw.title.getCurrentTitle().nsText ~= 'Template' then  
table.insert(categories, "Siwa lemmas with Western IPA pronunciation")
table.insert(categories, "Siwa lemmas with Western IPA pronunciation")

Navigation menu