Module:Wt/haw/gender and number/doc
This is the documentation page for Module:Wt/haw/gender and number
This module shows gender annotations, such as m or f pl. "Gender" is something of a misnomer, as the available annotation categories include animacy and verb aspect (though the former is sometimes also considered a part of word gender). It is used as part of other modules, or can be called from a template. The module is invoked with a list of one or more "gender specifications". A specification is a single, full "gender", and can be either a simple gender such as "m", a combination of gender and number like "m-p" or something else.
Gender specifications for Lua script writers
[edit source]Every specification is a list of codes, given as a single string with the codes separated by hyphens. Each code is defined within the module itself, and when displaying a specification, each code in the specification is converted into the appropriate display form. The different codes within the specification are then added together, separated by spaces. If the module is given several specifications at once (in a list), then each item in the list is separated by a comma.
Examples:
List | Result |
---|---|
{"m"} | m |
{"m-p"} | m pl |
{"m-an-p"} | m anim pl |
{"f-d", "m-p"} | f du, m pl |
{"m-p", "f-p"} | m pl, f pl |
{"m", "f", "p"} | m, f, pl |
Specifications that begin with "c" (but not "c" itself) are treated specially. They are considered noun classes, and the part immediately after the "c" is simply treated as some kind of name for a noun class; usually this will be a number. Noun classes do not have sub-parts, so they will not contain hyphens. When more than one specification is given, they must all be noun classes, and they are displayed separated with a forward slash instead, and preceded by class.
Examples:
List | Result |
---|---|
{"c1"} | class 1 |
{"c1", "c2"} | class 1/2 |
{"c1a", "c2a"} | class 1a/2a |
Usage
[edit source]The module can be used from another module by importing it and calling the exported format_list
function. It requires one parameter, which must be a table of zero or more strings. It will then return a string containing the result. For example:
local gen = require("Module:Wt/haw/gender and number")
local example1 = gen.format_list({"m"})
local example2 = gen.format_list({"m", "f"})
local example3 = gen.format_list({"m-p"})
WARNING: The list passed in will be overwritten.
It can also be invoked from a template. The function show_list
is used for this. It works the same way as the format_list
function, but the specifications are passed as parameters to the module invocation, like so:
*{{#invoke:Wt/haw/gender and number|show_list|m}} *{{#invoke:Wt/haw/gender and number|show_list|m|f}} *{{#invoke:Wt/haw/gender and number|show_list|m-p}}
- m
- m, f
- m pl
There is no limit to the number of parameters that can be given this way. The module will process all of its parameters until it finds one that is empty. This means that the following will display only "m" and not "m, n":
{{#invoke:Wt/haw/gender and number|show_list|m||n}}