|
|
Line 49: |
Line 49: |
| return mw_src | | return mw_src |
| end | | end |
|
| |
| --[==[local function inflection(base_form, x_categories, y_categories, stem, collapsed_highlight_coords)
| |
| local wikicode = {}
| |
|
| |
| table.insert(wikicode, "{| class=\"inflection-table vsSwitcher\" data-toggle-category=\"inflection\" style=\"background: #FAFAFA; border: 1px solid #d0d0d0; text-align: left;\" cellspacing=\"1\" cellpadding=\"2\"")
| |
| table.insert(wikicode, "|- style=\"background: #CCCCFF;\"\n! class=\"vsToggleElement\" colspan=\"" .. (#x_categories + 1) .. "\" | " .. stem[1])
| |
|
| |
| table.insert(wikicode, "|- class=\"vsShow\" style=\"background: #CCCCFF;\"")
| |
| table.insert(wikicode, "!")
| |
|
| |
| table.insert(wikicode, "! style=\"min-width: 11em; background: #CCCCFF;\" | " .. x_categories[1])
| |
|
| |
| for _, highlight in ipairs(collapsed_highlight_coords) do
| |
| table.insert(wikicode, "|- class=\"vsShow\" style=\"background: #F2F2FF;\"")
| |
| table.insert(wikicode, "! style=\"min-width: 8em; background: #E6E6FF;\" | " .. y_categories[highlight[2]])
| |
|
| |
| table.insert(wikicode, "| style=\"min-width: 11em;\" | " .. string.format(stem[2][highlight[2]][highlight[1]], base_form))
| |
| end
| |
|
| |
| table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #CCCCFF;\"")
| |
| table.insert(wikicode, "!")
| |
|
| |
| for _, x_cat in ipairs(x_categories) do
| |
| table.insert(wikicode, "! style=\"min-width: 11em; background: #CCCCFF;\" | " .. x_cat)
| |
| end
| |
|
| |
| for y_i, y_cat in ipairs(y_categories) do
| |
| table.insert(wikicode, "|- class=\"vsHide\" style=\"background-color: #F2F2FF;\"\n! style=\"min-width: 8em; background-color: #E6E6FF;\" | " .. y_cat)
| |
|
| |
| for x_i, x_cat in ipairs(x_categories) do
| |
| table.insert(wikicode, "| " .. string.format(stem[2][y_i][x_i], base_form))
| |
| end
| |
| end
| |
|
| |
| table.insert(wikicode, [=[|}]=])
| |
|
| |
| local mw_src = table.concat(wikicode, "\n")
| |
|
| |
| return mw.ustring.gsub(mw_src, "{{{([a-z0-9_]+)}}}", repl)
| |
| end
| |
|
| |
| function m.lthm_noun(frame)
| |
| local noun_stems = {
| |
| ["e-stem"] = {
| |
| "e-stem",
| |
| {
| |
| {"%set-", "%sKL̀t"},
| |
| {"%seĺ-", "%sKỳĺ"},
| |
| {"%sḿeDat-", "%sKLeT"},
| |
| {"%soNat-", "%sKL̀n"},
| |
| {"%sraBet-", "%sKRaB"},
| |
| }
| |
| },
| |
| ["e-stem y-var"] = {
| |
| "e-stem y-variation",
| |
| {
| |
| {"%syet-", "%sỳKL̀t"},
| |
| {"%syeĺ-", "%sỳKỳĺ"},
| |
| {"%sỳḿeDat-", "%sỳKLeT"},
| |
| {"%syoNat-", "%sỳKL̀n"},
| |
| {"%sỳraBet-", "%sỳKRaB"},
| |
| }
| |
| },
| |
| ["a-stem"] = {
| |
| "a-stem",
| |
| {
| |
| {"%sat-", "%sKL̀t"},
| |
| {"%saĺ-", "%sKỳĺ"},
| |
| {"%sḿat-", "%sKLaT"},
| |
| {"%soNat-", "%sKL̀n"},
| |
| {"%sraBat-", "%sKRaB"},
| |
| }
| |
| }
| |
| }
| |
|
| |
| local args = m_args.getArgs(frame)
| |
|
| |
| local root = args[1]
| |
| local stem_id = args[2]
| |
|
| |
| local stem = noun_stems[stem_id]
| |
|
| |
| if not stem then
| |
| error(string.format("No stem found with identifier '%s'", root))
| |
| end
| |
|
| |
| return "<h4>Inflection</h4>" .. inflection(
| |
| root,
| |
| {"Definite", "Indefinite"},
| |
| {"Nominative", "Objective", "Locative", "Ablative", "Lative"},
| |
| stem,
| |
| {{1, 1}, {1, 2}}
| |
| )
| |
| end
| |
| ]==]
| |
|
| |
|
| return m | | return m |