Modul:accel/mn
Qiyofa
Bu modul uchun Modul:accel/mn/doc nomli hujjat sahifasini yaratishingiz mumkin
local m_string_utilities = require( "Module:string utilities" )
local inflect_noun = require( "Module:mn-noun" ).inflect_traditional_form
local match = mw.ustring.match
local sub = mw.ustring.sub
return {generate = function ( params, entry )
if params.form == "traditional" then
local pos_to_head_template = {
["adjective"] = "mn-adj",
["adverb"] = "mn-adv",
["clitic"] = "mn-clitic",
["conjunction"] = "mn-conjunction",
["converb"] = "mn-converb",
["determiner"] = "mn-determiner",
["interjection"] = "mn-interj",
["noun"] = "mn-noun",
["numeral"] = "mn-numeral",
["participle"] = "mn-participle",
["particle"] = "mn-particle",
["postposition"] = "mn-postposition",
["pronoun"] = "mn-pronoun",
["proper noun"] = "mn-prop",
["suffix"] = "mn-suffix",
["verb"] = "mn-verb",
}
local head_template = pos_to_head_template[params.pos]
if head_template then
entry.head = '{{' .. head_template .. '}}'
end
entry.override = "{{mn-variant|" .. params.target_pagename .. "|" .. params.target_pagename .. "|" .. params.origin_pagename .. "}}\n\n===Pronunciation===\n{{mn-IPA-see|" .. params.origin_pagename .. "}}\n\n===" .. entry.pos_header .. "===\n" .. entry.head .. "\n\n" .. "# {{mn-see|" .. params.origin_pagename .. "}}"
else
local pos_to_head_template = {
["clitic"] = "mn-clitic-form",
["noun"] = "mn-noun-form",
["numeral"] = "mn-numeral-form",
["participle"] = "mn-participle-form",
["particle"] = "mn-particle-form",
["pronoun"] = "mn-pronoun-form",
["proper noun"] = "mn-proper noun-form",
["suffix"] = "mn-suffix-form",
["verb"] = "mn-verb-form",
}
local args = {
["Cyrl"] = params.target_pagename,
["form"] = params.form,
["head"] = pos_to_head_template[params.pos],
["origin"] = params.origin_pagename,
["pos_header"] = entry.pos_header
}
local Mong = match( mw.title.new( args.origin ):getContent(), "{{mn%-variant|(.-)|.*}}" ) or ""
local cyrl_form_args = match( mw.title.new( args.origin ):getContent(), "{{mn%-decl|(.-)}}" ) or nil
if params.pos == "noun" or params.pos == "proper noun" or params.pos == "pronoun" then
args.Mong = inflect_noun( Mong, args.origin, params.target, cyrl_form_args, args.form ) or ""
end
if sub( params.target, 1, 1 ) == "-" then
args.pronunc = sub( params.target, 2 )
else
args.pronunc = params.target
end
if match( args.form, "spos|indgen" ) then
args.poss = "spos"
elseif match( args.form, "cpos|indgen" ) then
args.poss = "cpos"
end
local layout
if match( args.form, "indgen" ) then
layout = [===[{\op}{\op}mn-variant|{Mong}|{Cyrl}{\cl}{\cl}
===Pronunciation===
{\op}{\op}mn-IPA|{pronunc}{\cl}{\cl}
==={pos_header}===
{\op}{\op}{head}{\cl}{\cl}
# {\op}{\op}inflection of|mn|{origin}||{form}{\cl}{\cl}
====Declension====
{\op}{\op}mn-decl|{pronunc}<{poss}>{\cl}{\cl}]===]
else
layout = [===[{\op}{\op}mn-variant|{Mong}|{Cyrl}{\cl}{\cl}
===Pronunciation===
{\op}{\op}mn-IPA|{pronunc}{\cl}{\cl}
==={pos_header}===
{\op}{\op}{head}{\cl}{\cl}
# {\op}{\op}inflection of|mn|{origin}||{form}{\cl}{\cl}]===]
end
entry.override = m_string_utilities.format( layout, args )
end
end}