This module contains new entry creation rules for Mongolian; see WT:ACCEL for an overview, and Module:accel for information on creating new rules.
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 = {
= "mn-adj",
= "mn-adv",
= "mn-clitic",
= "mn-conjunction",
= "mn-converb",
= "mn-determiner",
= "mn-interj",
= "mn-noun",
= "mn-numeral",
= "mn-participle",
= "mn-particle",
= "mn-postposition",
= "mn-pronoun",
= "mn-prop",
= "mn-suffix",
= "mn-verb",
}
local head_template = pos_to_head_template
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 = {
= "mn-clitic-form",
= "mn-noun-form",
= "mn-numeral-form",
= "mn-participle-form",
= "mn-particle-form",
= "mn-pronoun-form",
= "mn-proper noun-form",
= "mn-suffix-form",
= "mn-verb-form",
}
local args = {
= params.target_pagename,
= params.form,
= pos_to_head_template,
= params.origin_pagename,
= 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}