Module:qay-noun: Difference between revisions
No edit summary Tag: Reverted |
No edit summary |
||
| (8 intermediate revisions by the same user not shown) | |||
| Line 13: | Line 13: | ||
local gsplit = mw.text.gsplit | local gsplit = mw.text.gsplit | ||
local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " | local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ") | ||
local NAMESPACE = mw.title.getCurrentTitle().nsText | local NAMESPACE = mw.title.getCurrentTitle().nsText | ||
| Line 55: | Line 55: | ||
end | end | ||
args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true) | args = require("Module:parameters").process(parent_args, m_data[sub(genders[parent_args[1]],1,2) .. "_" .. decl_type].params, true) | ||
if numbers then | if numbers then | ||
| Line 67: | Line 67: | ||
data.head = parent_args["head"] or word | data.head = parent_args["head"] or word | ||
data.whole_word = parent_args["word"] and true or false | |||
data.proper = parent_args["proper"] and true or false | data.proper = parent_args["proper"] and true or false | ||
data.nocat = parent_args["nocat"] and true or false | data.nocat = parent_args["nocat"] and true or false | ||
data.g = genders[g] | data.g = genders[g] | ||
data.nopl = parent_args["nopl"] and true or false | data.nopl = parent_args["nopl"] and true or false | ||
data.pt = parent_args["pt"] and true or false --pluralia tantum | |||
if data.proper then data.nopl = true end | if data.proper then data.nopl = true end | ||
data.decl_type = decl_type | data.decl_type = decl_type | ||
| Line 103: | Line 105: | ||
local function link(term) | local function link(term) | ||
local links = {} | local links = {} | ||
for alt in gmatch(term, "([^ | for alt in gmatch(term, "([^,]+)") do | ||
alt = "[[Contionary:" .. alt .. "|" .. alt .. "]]" | alt = "[[Contionary:" .. alt .. "|" .. alt .. "]]" | ||
table.insert(links, alt) | table.insert(links, alt) | ||
| Line 132: | Line 134: | ||
for _, case in ipairs(cases) do | for _, case in ipairs(cases) do | ||
local case_short = sub(case, 1, 3) | local case_short = sub(case, 1, 3) | ||
table.insert(ret, '|- \n! style="background-color:#FFF0DC" | ' .. case .. '\n') | table.insert(ret, '|- \n! style="background-color:#FFF0DC" width="30%" | ' .. case .. '\n') | ||
table.insert(ret, '| ' .. link(show_form(data.forms[case_short .. '_s'])) .. '\n') | if not data.pt then | ||
table.insert(ret, '| ' .. link(show_form(data.forms[case_short .. '_s'])) .. '\n') | |||
end | |||
if not data.nopl then | if not data.nopl then | ||
table.insert(ret, '| ' .. link(show_form(data.forms[case_short .. '_p'])) .. '\n') | table.insert(ret, '| ' .. link(show_form(data.forms[case_short .. (data.pt and '_s' or '_p')])) .. '\n') | ||
end | end | ||
end | end | ||
| Line 142: | Line 146: | ||
local navframe = [=[ | local navframe = [=[ | ||
<div class="mw-collapsible" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; border: 1px solid #aaaaaa; text-align: center; font-size: 95%; overflow: auto; width: | <div class="mw-collapsible" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; border: 1px solid #aaaaaa; text-align: center; font-size: 95%; overflow: auto; width: 50%;"> | ||
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF); background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);">''{{{title}}}'' — {{{gender}}} noun ({{{decl_type}}})</div> | <div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF); background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);">''{{{title}}}'' — {{{gender}}} noun ({{{decl_type}}})</div> | ||
<div class="mw-collapsible-content" style="font-size: 100%;"> | <div class="mw-collapsible-content" style="font-size: 100%;"> | ||
| Line 151: | Line 155: | ||
|- | |- | ||
! | ! | ||
]=] .. (data.pt and "\n" or [=[ | |||
! style="background-color:#F4E6AC" | Singular | ! style="background-color:#F4E6AC" | Singular | ||
]=] .. (data.nopl and "\n" or [=[ | ]=]) .. (data.nopl and "\n" or [=[ | ||
! style="background-color:#F4E6AC" | Plural | ! style="background-color:#F4E6AC" | Plural | ||
]=]) .. make_cases(data) .. [=[ | ]=]) .. make_cases(data) .. [=[ | ||