45,337
edits
No edit summary |
No edit summary |
||
(14 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
local syllables = require("Module:qhv-pron").write_stress | local syllables = require("Module:qhv-pron").write_stress | ||
local alldata = require('Module:qhv-noun/data') | local alldata = require('Module:qhv-noun/data') | ||
local PAGENAME = mw.title.getCurrentTitle().text | local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ") | ||
local NAMESPACE = mw.title.getCurrentTitle().nsText | local NAMESPACE = mw.title.getCurrentTitle().nsText | ||
local NONSYLLABIC = u(0x032F) -- non-syllabic, combining inverted breve below | local NONSYLLABIC = u(0x032F) -- non-syllabic, combining inverted breve below | ||
local DIPHTHONG = u(0x035C) -- double articulation, combining double breve below | local DIPHTHONG = u(0x035C) -- double articulation, combining double breve below | ||
local lang = require("Module:languages").getByCode("qhv") | |||
local export = {} | local export = {} | ||
Line 27: | Line 29: | ||
} | } | ||
local | local reanalyzed_endings = { | ||
["[i]ar"] = "c-1", ["yn"] = "p-2", ["yr"] = "c-2", ["un"] = "p-3", ["ȳn"] = "p-3", ["[i]or"] = "c-3", ["in"] = "p-4", ["er"] = "c-4", | |||
["ir"] = "c-5", ["rjin"] = "p-5", | |||
} | |||
function export.detect_decl(word, number, class) | function export.detect_decl(word, number, class, reanalyzed) | ||
local syllables = require("Module:qhv-pron").write_stress(word, true) | local syllables = require("Module:qhv-pron").write_stress(word, true) | ||
local IPA = require("Module:qhv-pron").crux(word) | local IPA = require("Module:qhv-pron").crux(word) | ||
Line 43: | Line 41: | ||
local decl = number .. "-" .. class | local decl = number .. "-" .. class | ||
return decl, {sub(word, 1, -(#endings_reverse[decl] + 1))} | return decl, {sub(word, 1, -(#endings_reverse[decl] + 1))} | ||
elseif word:find("illa$") then | |||
return "-illa", {sub(word, 1, -2)} | |||
elseif word == "skorlūs" then | |||
return "3-s-h", {sub(word, 1, -2)} | |||
elseif reanalyzed then | |||
for ending, decl in pairs(reanalyzed_endings) do | |||
if find(word, ending .. "$") then | |||
return "r-" .. decl, {sub(word, 1, -(#ending + 1))} | |||
end | |||
end | |||
elseif (not find(IPA, "ˈ")) and (find(IPA, NONSYLLABIC .. ".$") or find(IPA, DIPHTHONG .. vowel .. ".$") or find(IPA, "ː.$")) then | elseif (not find(IPA, "ˈ")) and (find(IPA, NONSYLLABIC .. ".$") or find(IPA, DIPHTHONG .. vowel .. ".$") or find(IPA, "ː.$")) then | ||
return "3-s-h", {sub(word, 1, -2)} | return "3-s-h", {sub(word, 1, -2)} | ||
Line 62: | Line 70: | ||
local decl = {} | local decl = {} | ||
local word = NAMESPACE == "Template" and "vala" or parent_args.word or PAGENAME | local word = NAMESPACE == "Template" and "vala" or parent_args.word or PAGENAME | ||
local reanalyzed = parent_args["r"] | |||
local args = {} | local args = {} | ||
Line 72: | Line 81: | ||
numbers = {parent_args[1]} | numbers = {parent_args[1]} | ||
else | else | ||
decl_type, numbers = export.detect_decl(word, parent_args.n, parent_args.c) | decl_type, numbers = export.detect_decl(word, parent_args.n, parent_args.c, reanalyzed) | ||
end | end | ||
end | end | ||
Line 93: | Line 102: | ||
pass.head = parent_args["head"] or nil | pass.head = parent_args["head"] or nil | ||
pass.proper = parent_args["proper"] and true or false | pass.proper = parent_args["proper"] and true or false | ||
pass.nocat = parent_args["nocat"] and true or false | |||
-- Generate the forms | -- Generate the forms | ||
Line 124: | Line 134: | ||
local links = {} | local links = {} | ||
for alt in gmatch(term, "([^%s,]+)") do | for alt in gmatch(term, "([^%s,]+)") do | ||
alt = "[[Contionary:" .. alt .. " | alt = "[[Contionary:" .. alt .. "|" .. alt .. "]]" | ||
table.insert(links, alt) | table.insert(links, alt) | ||
end | end | ||
Line 178: | Line 188: | ||
|}]=] | |}]=] | ||
return | |||
return gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl) .. (not pass.nocat and require("Module:utilities").format_categories(pass.categories, lang) or "") | |||
end | end | ||
return export | return export |