10,731
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) (Fixed) |
||
Line 5: | Line 5: | ||
local m_rad_syllables = require("Module:rad-syllables") | local m_rad_syllables = require("Module:rad-syllables") | ||
local m_syllables = require("Module:syllables") | local m_syllables = require("Module:syllables") | ||
local m_links = require("Module:links") | |||
local m_languages = require("Module:languages") | |||
local m_parameters = require("Module:parameters") | local m_parameters = require("Module:parameters") | ||
Line 30: | Line 32: | ||
-- All possible "modes": | -- All possible "modes": | ||
local parameter = {["IPA"] = | local parameter = {["IPA"] = "IPA", ["syllables"] = "syllables", ["homophones"] = "homophones"} | ||
local register = {["colloquial"] = | local register = {["colloquial"] = "colloquial", ["formal"] = "formal"} | ||
local dialect = {["hjádvanþs"] = | local dialect = {["hjádvanþs"] = "hjádvanþs", ["coastal"] = "coastal", ["insular"] = "insular"} | ||
local word = args[1] | local word = args[1] | ||
Line 96: | Line 98: | ||
if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then | if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then | ||
local just_phonemic = mw.ustring. | local just_phonemic = mw.ustring.gmatch(args[i], "%/(.*)%/") | ||
insert_rhyme(just_phonemic) | insert_rhyme(just_phonemic) | ||
end | end | ||
Line 104: | Line 106: | ||
syllables_no_auto = true | syllables_no_auto = true | ||
elseif args[i] == "" then | elseif args[i] == "" then | ||
if mw.ustring. | if mw.ustring.gmatch(working_syllables, "(%|)") then | ||
table.insert(syllables, working_syllables) | table.insert(syllables, working_syllables) | ||
mw.log("Syllables: " .. working_syllables .. " registered.") | mw.log("Syllables: " .. working_syllables .. " registered.") | ||
end | end | ||
working_syllables = "" | working_syllables = "" | ||
elseif args[i+1] == nil then | |||
working_syllables = working_syllables .. "|" .. args[i] | |||
if mw.ustring.gmatch(working_syllables, "(%|)") then | |||
table.insert(syllables, working_syllables) | |||
mw.log("Syllables: " .. working_syllables .. " registered.") | |||
end | |||
else | else | ||
working_syllables = working_syllables .. "|" .. args[i] | working_syllables = working_syllables .. "|" .. args[i] | ||
Line 137: | Line 145: | ||
end | end | ||
if syllables_no_auto == false and mw.ustring. | if syllables_no_auto == false and mw.ustring.gmatch(auto_syllables, "(%|)") then | ||
table.insert(syllables, 1, auto_syllables) | table.insert(syllables, 1, auto_syllables) | ||
end | end | ||
Line 147: | Line 155: | ||
end | end | ||
local | local args_temp = {} | ||
local accent_temp = {} | |||
args_temp = IPA["standard"]["plain"] | |||
table.insert(args_temp, 1, "rad") | |||
local IPA_show = "* " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
for r, _ in pairs(register) do | for r, _ in pairs(register) do | ||
if #IPA["standard"][r] > 0 then | if #IPA["standard"][r] > 0 then | ||
IPA_show = IPA_show .. "\n** (<i>" .. r .. "</i>) | args_temp = IPA["standard"][r] | ||
table.insert(args_temp, 1, "") | |||
IPA_show = IPA_show .. "\n** (<i>" .. r .. "</i>) " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
end | end | ||
end | end | ||
if #IPA["hjádvanþs"]["plain"] > 0 then | if #IPA["hjádvanþs"]["plain"] > 0 then | ||
IPA_show = IPA_show .. "\n** {{ | args_temp = IPA["hjádvanþs"]["plain"] | ||
table.insert(args_temp, 1, "") | |||
IPA_show = IPA_show .. "\n** " .. frame:expandTemplate{ title = "accent", args = { "rad", "hjádvanþs" } } .. " " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
end | end | ||
for r, _ in pairs(register) do | for r, _ in pairs(register) do | ||
if #IPA["hjádvanþs"][r] > 0 then | if #IPA["hjádvanþs"][r] > 0 then | ||
IPA_show = IPA_show .. "\n** {{ | args_temp = IPA["hjádvanþs"][r] | ||
table.insert(args_temp, 1, "") | |||
IPA_show = IPA_show .. "\n** " .. frame:expandTemplate{ title = "accent", args = { "rad", "hjádvanþs", r } } .. " " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
end | end | ||
end | end | ||
Line 169: | Line 188: | ||
if #IPA[d]["plain"] > 0 then | if #IPA[d]["plain"] > 0 then | ||
IPA_show = IPA_show .. "\n** {{ | args_temp = IPA[d]["plain"] | ||
table.insert(args_temp, 1, "") | |||
IPA_show = IPA_show .. "\n** " .. frame:expandTemplate{ title = "accent", args = { "rad", d } } .. " " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
end | end | ||
for r, _ in pairs(register) do | for r, _ in pairs(register) do | ||
if #IPA[d][r] > 0 then | if #IPA[d][r] > 0 then | ||
IPA_show = IPA_show .. "\n** {{ | args_temp = IPA[d][r] | ||
table.insert(args_temp, 1, "") | |||
IPA_show = IPA_show .. "\n** " .. frame:expandTemplate{ title = "accent", args = { "rad", d, r } } .. " " .. frame:expandTemplate{ title = "IPA", args = args_temp } | |||
end | end | ||
end | end | ||
Line 182: | Line 205: | ||
if #homophones > 0 then | if #homophones > 0 then | ||
homophones_show = "\n* Homophones: | homophones_show = "\n* Homophones:" | ||
for _, item in ipairs(table.sort(homophones)) do | |||
homophones_show = homophones_show .. ", " .. m_links.full_link{ term = item, language = m_languages.get_by_code("rad") } | |||
end | |||
homophones_show = mw.ustring.gsub(homophones_show, "(%:%,)", "%:") | |||
end | end | ||
Line 188: | Line 215: | ||
if #rhymes > 0 then | if #rhymes > 0 then | ||
rhymes_show = "\n* | rhymes_show = "\n* Rhymes:" | ||
for _, rhyme in ipairs(rhymes) do | |||
rhymes_show = rhymes_show .. " <span class=\"IPA\">[[:Category:Rhymes:Radestrian/" .. rhyme .. "|-" .. rhyme .. "]]</span>[[Category:Rhymes:Radestrian/" .. rhyme .. "]]" | |||
end | |||
end | end | ||
local syllables_show = "" | local syllables_show = "" | ||
local function split_syllables(input) | |||
local syllables = {} | |||
for syl in mw.ustring.gmatch(input, "([^%|]+)") do | |||
table.insert(syllables, syl) | |||
end | |||
return syllables | |||
end | |||
if #syllables > 0 then | if #syllables > 0 then | ||
syllables_show = "\n* { | syllables_show = "\n* " | ||
args_temp = { "rad" } | |||
for set = 1, #syllables do | |||
if set > 1 then | |||
table.insert(args_temp, "") | |||
end | |||
local working_syllables = split_syllables(syllables[set]) | |||
for syl = 1, #working_syllables do | |||
table.insert(args_temp, working_syllables[syl]) | |||
end | |||
end | |||
syllables_show = syllables_show .. frame:expandTemplate{ title = "syllables", args = args_temp } | |||
end | end | ||
return | return IPA_show .. homophones_show .. rhymes_show .. syllables_show | ||
end | end |