Модул:gender and number/док

Ово је документациона подстраница за Модул: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[уреди]

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.

Примери:

Листа Резултат
{"m"} m
{"m-p"} m pl
{"m-an-p"} m anim pl
{"f-d", "m-p"} f du or m pl
{"m-p", "f-p"} m pl or f pl
{"m", "f", "p"} m or f or 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.

Примери:

Листа Резултат
{"c1"} class 1
{"c1", "c2"} class 1/2
{"c1a", "c2a"} class 1a/2a

Употреба[уреди]

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. Као пример:

local gen = require("Модул: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:gender and number|show_list|m}}
*{{#invoke:gender and number|show_list|m|f}}
*{{#invoke:gender and number|show_list|m-p}}
  • m
  • m or 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 or n":

{{#invoke:gender and number|show_list|m||n}}