Module:User:Wikitiki89/ru-pre-reform-gen
Jump to navigation
Jump to search
- This module sandbox lacks a documentation subpage. You may create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Wikitiki89, for his own experimentation. Items in this module may be added and removed at Wikitiki89's discretion; do not rely on this module's stability.
local export = {}
local temp = {}
local temp_d = nil
local extra = {}
local extra_d = nil
local single_subs = {
["і"] = "и",
["ї"] = "и",
["ѵ"] = "и",
["ѷ"] = "и",
["І"] = "И",
["Ї"] = "И",
["Ѵ"] = "И",
["Ѷ"] = "И",
["ѣ"] = "е",
["Ѣ"] = "Е",
["ѳ"] = "ф",
["Ѳ"] = "Ф",
}
local old_to_new = function(s)
s = mw.ustring.gsub(s, ".", single_subs)
s = mw.ustring.gsub(s, "ъи", "ы")
s = mw.ustring.gsub(s, "[Ъъ][Ии]", "Ы")
s = mw.ustring.gsub(s, "[Ъъ]$", "")
s = mw.ustring.gsub(s, "[Ъъ]%f[^%a]", "")
return s
end
function export.gen(frame)
local args = frame:getParent().args
local realword = (args[2] ~= "" and args[2]) or mw.title.getCurrentTitle().subpageText
args["word"] = args["word"] or realword
args["pos"] = args["pos"] or (args[1] ~= "" and args[1]) or "noun"
args["Pos"] = mw.ustring.gsub(args["pos"], "^.", mw.ustring.upper, 1)
args["new"] = args["new"] or old_to_new(realword)
args["p"] = mw.ustring.gsub(args["p"] or "", "!", "|")
args["h"] = mw.ustring.gsub(args["h"] or "", "!", "|")
args["d"] = mw.ustring.gsub(args["d"] or "", "!", "|")
-- local f = extra[args["pos"]] or extra_d; f(args)
return require("Module:string utilities").format(temp[args["pos"]] or temp_d, args)
end
temp["adj"] = [===[==Russian==
===Adjective===
{\op}{\op}ru-adj|{word}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}
====Declension====
{\op}{\op}ru-adj-old|{word}{d}{\cl}{\cl}]===]
temp["adv"] = [===[==Russian==
===Adverb===
{\op}{\op}ru-adv|{word}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}]===]
temp["proper noun"] = [===[==Russian==
===Proper noun===
{\op}{\op}ru-proper noun+|old=1{p}|{word}{d}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}
====Declension====
{\op}{\op}ru-noun-table|old=1{p}|{word}{d}|n=sg{\cl}{\cl}]===]
temp["noun"] = [===[==Russian==
===Noun===
{\op}{\op}ru-noun+|old=1{p}|{word}{d}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}
====Declension====
{\op}{\op}ru-noun-table|old=1{p}|{word}{d}{\cl}{\cl}]===]
temp["verb"] = [===[==Russian==
===Verb===
{\op}{\op}ru-verb|{word}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}]===]
temp_d = [===[==Russian==
==={Pos}===
{\op}{\op}head|ru|{pos}|head={word}{h}{\cl}{\cl}
# {\op}{\op}ru-pre-reform|{new}{\cl}{\cl}]===]
extra["noun"] = function(args)
_, _, args["stem"], args["ending"] = mw.ustring.find(args["word"], "^(.*)(.)$")
if args["s"] then
args["stem"] = args["s"]
args["d"] = "|" .. args["word"] .. args["d"]
end
if args["e"] then
args["ending"] = args["e"]
end
args["p"] = args["p"] or (args[3] ~= "" and args[3]) or ""
end
extra["proper noun"] = extra["noun"]
extra["adj"] = function(args)
_, _, args["stem"], args["ending"] = mw.ustring.find(args["word"], "^(.-)([ЪъЬьІіЇїЫыОоЕеЁёАаЯя][ЙйЕеЯя]?)$")
args["p"] = args["p"] or (args[3] ~= "" and args[3]) or ""
if args["p"] ~= "" and args["p"] ~= "Ь" then
args["p"] = "ь"
end
end
extra_d = function(args)
end
return export