MediaWiki:Gadget-AcceleratedFormCreation.js/documentation


 * To edit the rules for generating new form-of entries, go to Module:accel.

This gadget allows you to automatically generate entries for inflected forms of words.

Enabling accelerated links
To enable the gadget, enable it in the Gadgets tab of your preferences: item "". If you do not have an account, you can enable it in your per-browser preferences instead.

Creating new entries
Many existing pages and templates already support the acceleration gadget. If a link allows you to generate a new entry automatically, it will appear bright green. To start creating an entry, simply click the link, which will take you to edit it. The edit window will automatically have the new entry added to it. You can then save the page like you would any other page. The order in which the definitions appear is determined by the order in which they appear in the lemma entry, but can be modified; see below under.

It is important that you check the new entry to make sure that everything is correct! Although editors should take great care to make sure that the gadget does not generate bad entries, it is your own responsibility to make sure you don't inadvertently add incorrect or badly formatted content to Wiktionary. If the gadget is generating wrong entries, you should report this to the Grease pit, or fix it yourself if you are able.

Making a template use the script
Adjusting a template or module to use the script is relatively easy. Whenever your template/module shows a link to an inflected form, you need to provide it with some extra information. This extra information consists of "tags" that tell the script how to process your link, so that the right entry is generated.

Module:accel will generate a default entry based on the tags you provide (the specific details are explained in its documentation). If this is not sufficient, i.e. if the entries need to be formatted in a language-specific way, you can create your own submodule of Module:accel and write your own rules. If you don't know how, ask in WT:GP for help.

Acceleration tags
The following is a list of tags that you can add to links to enable accelerated forms to be created. Each tag is associated with either (a) a template parameter to provide it when used with link templates such as or ; (b) a key in the table passed as the lua key in the lua parameter to the lua function in Module:links, when called from a module.

lua (in modules) or accel-form (in templates)
 * Which particular form the link is for. It should use the inflection codes used in, with pipe symbols (vertical bars) separating the inflection codes. When called from a module, use the pipe symbols directly, e.g. lua for nominative masculine plural. When used in template code, you will need to encode the pipe symbols using , e.g. nom. You can also specify arbitrary text such as  , but this must be interpreted by a language-specific module (such as Module:accel/ru for Russian) and converted into the appropriate definition. This is the only tag that is mandatory.

lua (in modules) or accel-gender (in templates)
 * The gender code that should be added to the headword line, using the same format that uses, e.g.   for masculine plural. This should only be needed in rare occasions. If the definition already mentions the gender, like "feminine form of" for example, then this is redundant and you should not add it.

lua (in modules) or accel-translit (in templates)
 * The transliteration that should appear on the headword line. The value of this parameter goes into param tr of the call to in the accelerated entry. You only need to specify this for languages that use a non-Latin script, and only when the auto-generated transliteration is insufficient, incorrect or nonexistent.

lua (in modules) or accel-lemma (in templates)
 * The lemma to be included in the call to on the definition line. The value of this parameter goes into param 2 of the call to . It defaults to the name of the current page, and only needs to be specified when the lemma contains additional diacritics that are stripped in order to generate the pagename (as in Latin, Russian, Ancient Greek, Old English, etc.).

lua (in modules) or accel-lemma-translit (in templates)
 * The manual transliteration of the lemma to be included in the call to on the definition line. The value of this parameter goes into param tr of the call to . You only need to specify this for languages that use a non-Latin script, and only when the auto-generated transliteration is insufficient, incorrect or nonexistent.

lua (in modules) or true (in templates)
 * Normally, the forms on a page are processed in reading order (left to right, top to bottom), and the entries/definitions will be added to the page in that order. This tag is used when the same form appears multiple times in a page/inflection table, and causes a particular link to be ignored for the ordering. This is useful when an inflection table shows some forms in its collapsed state, like for example or . By placing this tag on the links that appear in the collapsed state, their forms will not be shown before the forms in the rest of the table.

Adding the tags to a template
There are various ways to add accelerated creation to links, both in templates/wikicode and in modules/Lua. Acceleration tags should not be added directly to entries, there should always be a template that wraps around it.

Links that are created with the standard linking templates, and such have parameters for each of the tag types listed above, with the name prefixed with. Thus, for the  tag, you use the   parameter, e.g.

If you are working in a module using the  function of Module:links, the   key can be provided as one of the values in the table that's passed as the first parameter. The value should be a table containing the acceleration tags as keys, e.g.

full_link({lang = lang, term = "foos", accel = {form = "p"}})

When working on a headword template, you'll typically be using, and providing it with one or more inflected forms to show on the headword line. To provide acceleration tags for the inflected forms, the tag name is prefixed with  N stands for the number of the form, e.g.

In a module using the  function of Module:headword, you provide the   key in the list of inflections of a particular label. Its value is a table of tags, like as with Module:links, e.g.

full_headword({lang = lang, inflections = { {label = "plural", accel = {form = "p"}, "foos"}, {label = "diminutive", accel = {form = "diminutive"}, "bar"} }

When you're done, add to the documentation page of the template. This shows a notice that accelerated links are enabled for this template. It also adds the template to Category:Templates with acceleration.

Inflection tables organised by column
The order in which definitions appear in combined entries is determined by the order in which the links appear in the page/HTML code. This order is always in reading order: left to right, top to bottom. Many inflection tables are organised by column, and often you want the forms in one column to take priority over forms in another column. For example, it's generally desirable to have the definitions of singular forms appear before the definitions of plural forms. For this, there is the  attribute.

The  attribute is placed on the table cell which contains the accelerated inflection links, and is given a column number as a value. For example: ! Locative ! Comitative Columns with the same number are processed as a single unit, so all forms with column number 1 are processed before all forms with column number 2. Consequently, definitions for forms in column 1 will always appear in an entry before definitions for forms in column 2. If the inflection table contains another set of columns below the first set, the count continues, so that the columns are numbered 1, 2, 3, 4 and so on.
 * data-accel-col="1" |
 * data-accel-col="2" |
 * data-accel-col="1" |
 * data-accel-col="2" |

Column numbers are applied on a per-table basis. This means that if the same column number appears in multiple tables in the same language section, they will not interfere with each other; each new table "resets" the columns. Any table cell (but not a header cell with ) that does not have the   attribute will also cause a column reset. This means that you can have two different columns numbered 1, as long as there is a table cell without a column number in between them. Once a cell lacking a column number is encountered in the reading order, processing of the forms will continue in reading order as usual.

Rules for generating entries
The new entries themselves are not generated by this script, but by Module:accel and its language-specific submodules. If you want to add or edit rules for your language, look on the module's page for information and instructions.