Module:headword/documentation

This module is used to show headword lines, along with any annotations like genders, transliterations and inflections. It's used by the template, via the submodule Module:headword/templates. It's also used by many other headword modules; for a full list, see Category:Headword-line modules. Some of the data used by this module is found in Module:headword/data.

Further explanations for full_headword
The sole argument,, is a table containing the following items (WARNING: they will be destructively modified):

Further explanation:


 * is required and is a language object from Module:languages corresponding to a given language. For example, use to retrieve the object corresponding to Russian.
 * is optional and allows you to override the pagename used variously in the module (e.g. as the default value when a head is omitted, for setting categories such as palindromes and, etc.).
 * is a table listing the heads of the headword. Each element is either a string specifying only the headword itself (old-style), or an object specifying all the properties of the headword (new-style). You cannot mix and match these two styles; all elements should be of one type or the other. If no heads are specified at all ( is omitted or is an empty array), a default head is set based on the assumed pagename (either the actual pagename or the value of, if set). When using old-style head strings, a given head in the array can be , in which case a default head is set as above. When head objects are used, a given object can have the following properties:
 * : A string specifying the headword. This can be omitted, in which case a default head is set as above. Explicit headwords are generally used to specify extra diacritics (in languages with such diacritics, e.g. Russian, Arabic, Latin, Ancient Greek, Old English, etc.), or to link individual words of a multiword term, particularly when the words are inflected forms. Note that by default, each word is linked individually to itself, so there is no need to specify links for a term like . Some additional notes:
 * If a headword string contains wikilinks, they are converted into language-section links for the given language (using, which is also used by ). For example, giving , if the language provided is English, will produce: . If string is prefixed with * or if any of the links are, then they are interpreted as reconstructed terms and it will create links to the Reconstruction namespace as appropriate.
 * If the page name contains spaces or punctuation marks (except for punctuation marks that are used inside of words), it is split and each individual word is automatically wikilinked as above.
 * If the current page is in the  namespace, then an asterisk  will be prepended to the headword to indicate that it is a reconstructed term.
 * : A string specifying the transliteration of the headword. This is only needed when the headword is in a non-Latin script, and even then only when the automatic transliteration specified using the language's transliteration module is incorrect (or the language has no transliteration module, such as with Persian and Hebrew). For languages with a transliteration module, pass in to suppress the transliteration entirely.
 * : A string specifying the transcription of the headword. This is only used in a few languages with non-Latin scripts where the spelling is significantly different from the pronunciation, such as Akkadian, Old Persian or Hittite. In cases like this, the transliteration usually reflects the spelling and the transcription reflects the pronunciation. For this reason, transcriptions are displayed between slashes. Transcriptions should NOT be used simply to display IPA pronunciation of a language like Russian or Arabic. Unlike for transliterations, there are no automatic transcription modules.
 * : An optional script object from Module:scripts corresponding to a given script, specifying the script that the headword is in. If omitted, defaults to the top-level value. Most of the time, neither the per-headword script nor top-level script need to be specified: If both are omitted, Module:scripts will determine the script(s) using the list of scripts in the language's data file and the characters that are in the headword. Specifically, if there are multiple possible scripts for a language, the script with the largest number of characters in the headword is chosen.
 * : An optional array specifying one of more qualifiers displayed to the left of the headword. Qualifiers are displayed in italics and with parentheses around them, and are intended to specify relevant properties of the headword, especially when there is more than one headword.
 * : An optional array specifying one of more qualifiers displayed to the right of the headword, as above.
 * : An optional array specifying one of more references (i.e. footnotes) for the headword. This is similar to using  to specify a reference/footnote after a given word in the text. Each element of the array is either a string (the text of the reference) or an object of the form . In this latter format:
 * specifies the reference text (which cannot be ; use a blank string when cross-referencing to another reference);
 * gives an optional name to the reference for cross-reference purposes, if the reference text is non-empty, similarly to ; however, if the reference text is empty, it specifies a cross-reference to a previously-named reference, similarly to  ;
 * gives an optional group to the reference for grouping purposes, similarly to ; however, if the reference text is empty, it specifies the group of a cross-reference to a previously-named reference, similarly to.
 * : The separator preceding the headword. If omitted, the default value is  (i.e. the italicized word or surrounded by spaces) for the second and higher headword, and a blank string for the first headword. Use a blank string to request no separator at all.
 * is an optional table listing the transliterations corresponding to each headword in, when old-style head strings are used; omitting this field is equivalent to setting it to an empty list. If new-style head objects are used, this field must be omitted. The Nth numbered entry should be either a string specifying the transliteration of headword N, or may be omitted, as with the property described above. Note that, if there are multiple headwords, the table in  might have entries in the middle of the list that are . A list of this sort cannot be created with , as attempting to insert  this way does nothing. Instead, each transliteration must be explicitly assigned using a number as index, e.g. ; here, item  is , because no value was assigned to it.
 * is an optional table listing the transcriptions corresponding to each headword in, when old-style head strings are used; omitting this field is equivalent to setting it to an empty list. If new-style head objects are used, this field must be omitted. It is of the same format as , and can have holes in it as needed. The meaning of the transcription field is as described abobe for.
 * is an optional script object from Module:scripts corresponding to a given script. If specified, this applies equally to all heads specified using ; if you need to specify per-head scripts, use the head object format documented above. Most of the time you can omit this item, and Module:scripts will determine the script(s) as specified above for the headword property.
 * is a table listing the gender/number specifications for the headwords. This can be omitted for no genders or numbers. Each element is either a string specifying a gender/number spec, or a table of the form {{lua|1={spec = "gender/number_spec", qualifiers = nil or {"qualifier1", "qualifier2", ...} }}. In either case, the accepted values for genders or numbers are given in Module:gender and number; examples are for masculine,  for feminine animate plural and  for noun class 2 in languages such as Swahili that have noun classes. If the format with qualifiers is given, the qualifiers are displayed to the left of the gender/number specification. Categories are automatically added according to the specific genders, e.g.   for the language specified in  if the gender is masculine and the part of speech (see below) is   or  . To suppress the addition of these categories, specify.
 * is a table listing the inflections to be displayed in the headword entry. The format of this table is somewhat complex and is described below under.
 * is the part-of-speech category for the entry. This is one of the  and   parts of speech listed in Module:headword/data. It should be in the plural: for example, . If this item is omitted, the part of speech category must be included in as the first item in.
 * is a table listing the categories to which the entry containing the headword will be added. The first category should be a part-of-speech category, with the canonical name of the language at the beginning – – unless the part of speech is given in the field.
 * is a table listing language-agnostic categories to which the page will be added, which it is nevertheless useful for the headword module to handle (e.g. Category:Unsupported titles). Because they are not tied to a language, pages in them should be sorted according to their DEFAULTSORT: values for the sake of consistency. Note that some of these - including "Category:Unsupported titles" - are already handled automatically.
 * is a string specifying a sort key for the categories listed in . Sort keys should usually be omitted, because the  function in Module:utilities will generate a suitable sortkey in most cases. The sortkey is used to ensure that the page is listed in the correct order in the categories to which it belongs.
 * is a boolean value determining whether or not to link the individual words of a multiword headword, which is done by default.
 * is a boolean value determining whether or not to link the inflections of the entire headword. Not to be confused with, which disables linking only for one of the inflections. It is used, for example, by Module:la-headword for reconstructed terms.

A simple example
might give (depending on the page it's run on):

which displays as:
 * book (plural books)

A fuller example
might give (depending on the page it's run on):

which displays as:
 * Hund m (genitive Hundes or Hunds, plural Hunde or (nonstandard) Hünde, diminutive Hündchen n or Hündlein <abbr title="neuter gender">n )

An example in a non-Latin script
This example is in Russian, which has automatic transliteration:

might give (depending on the page it's run on):

which displays as
 * <strong class="Cyrl headword" lang="ru">кни́га • ( kníga  ) <abbr title="feminine gender">f inan (genitive <b class="Cyrl" lang="ru">кни́ги</b>, nominative plural <b class="Cyrl" lang="ru">кни́ги</b>, genitive plural <b class="Cyrl" lang="ru">книг</b>)

Note a few things about the transliteration:
 * If the transliteration is specified and non-empty, Module:headword adds some stuff before and after it. For example, if the transliteration is and the language is Hebrew, produces   which looks like “• ( foo )”.
 * The bullet linking to a transliteration policy page is only added if the page actually exists.

A fuller example in a non-Latin script
This example is in Russian, with two headwords, each of which requires manual transliteration:

might give (depending on the page it's run on):

which displays as
 * <strong class="Cyrl headword" lang="ru">интервьюе́р or <strong class="Cyrl headword" lang="ru">интервью́ер • ( intɛrvʹjuér or intɛrvʹjújer  ) <abbr title="masculine gender">m anim (genitive <b class="Cyrl" lang="ru">интервьюе́ра</b> or <b class="Cyrl" lang="ru">интервью́ера</b>, nominative plural <b class="Cyrl" lang="ru">интервьюе́ры</b> or <b class="Cyrl" lang="ru">интервью́еры</b>, genitive plural <b class="Cyrl" lang="ru">интервьюе́ров</b> or <b class="Cyrl" lang="ru">интервью́еров</b>)

Another fuller example in a non-Latin script
This example is in Arabic, with embedded links in the headword, manual transliteration in an inflection and use of :

might give (depending on the page it's run on):

which displays as
 * <strong class="Arab headword" lang="ar">غُدّة بَصَلِيّة إحْلِيلِيّة • ( ḡudda baṣaliyya ʾiḥlīliyya  ) <abbr title="feminine gender">f (plural <b class="Arab" lang="ar">غُدَد بَصَلِيَّة إِحْلِيلِيَة</b> ( ḡudad baṣaliyya ʾiḥlīliyya ))

Proposed/planned changes

 * Checking for invalid genders, given a list of genders that are valid for a particular language.