ମଡ୍ୟୁଲ:links/doc

ଉଇକିଅଭିଧାନ‌ରୁ

This is the documentation page for ମଡ୍ୟୁଲ:links

This module provides many useful utility functions for creating and processing wikilinks within Wiktionary.

template_l_term[ସମ୍ପାଦନା]

{{#invoke:links|template_l_term}}

This is called by the templates {{l}} and {{term}}. It gathers the template parameters and then calls full_link which does most of the work.

full_link[ସମ୍ପାଦନା]

full_link(term, alt, lang, sc, face, id, annotations, curtitle)

Creates a full link, with annotations, in the style of {{l}} or {{term}}. The parameters are: term (page name), alternative display, language object, script code, script face (see Module:script utilities#tag_text), senseid, table of annotations (see format_link_annotations). All parameters may be nil except for the annotations, but an error will be shown if the term, alt and transliteration (in the annotations) are all missing.

The function will:

  • Try to determine the script, based on the characters found in the term or alt parameter, if the script was not given.
  • Call language_link on the term/alt forms, to remove diacritics in the page name, process any embedded wikilinks and create links to appendix pages when necessary.
  • Call Module:script utilities#tag_text to add the appropriate language and script tags to the term.
  • Generate a transliteration, based on the alt or term parameters, if the script is not Latin and no transliteration was provided.
  • Add the annotations (transliteration, gender, gloss etc.) after the link.

format_link_annotations[ସମ୍ପାଦନା]

format_link_annotations(lang, info)

Formats annotations that are displayed with a link. Annotations are the extra bits of information that are displayed following the linked term, and include things such as gender, transliteration, gloss and so on. The first parameter is the language object, the second is a table possessing some or all of the following keys:

genders
Table containing a list of gender specifications in the style of Module:gender and number.
tr
Transliteration.
gloss
Gloss that translates the term in the link, or gives some other descriptive information.
pos
Part of speech of the linked term. If the given parameter matches one of the templates in Category:Part of speech tags, then call that to show a part-of-speech tag. Otherwise, just show the given text as it is.
lit
Literal meaning of the term, if the usual meaning is figurative or idiomatic.

Any of the above values can be omitted from the info parameter. If a completely empty table is given (with no annotations at all), then an empty string is returned.

language_link[ସମ୍ପାଦନା]

language_link(text, alt, lang, id, curtitle)

Creates a basic link to the given term. It links to the language section (such as #English), but it does not add language and script wrappers, so any code that uses this function should call Module:script utilities#tag_text to add such wrappers itself at some point.

It accepts the following parameters:

text
The text to turn into a link. This is generally the name of a page. The entry name will be processed by prepare_title to generate the correct entry name before creating a link.
The string can contain wikilinks already embedded in them. Embedded wikilinks can also contain their own alternative display text; this will be preserved, while the alt parameter is ignored. A language section will be added to each individual wikilink in the string, and each link's entry name will be processed by prepare_title individually.
If the text starts with *, then the term is considered a reconstructed term, and this will be passed on to prepare_title. If the text contains embedded wikilinks, then the * is applied to each one individually, while preserving the displayed form of each link. This allows linking to phrases containing multiple reconstructed terms, while only showing the * once at the beginning.
alt
The alternative display for the link, if this is different from the linked page. If this is nil, the text parameter is used instead (much like regular wikilinks). If text contains wikilinks in it, this parameter is ignored and has no effect.
lang
The language object for the term being linked.
id
An additional sense ID to insert into the link. This is used in conjunction with {{senseid}}. This is optional.
curtitle
When provided, the function won't link to this title. It is used in inflection tables.

remove_diacritics[ସମ୍ପାଦନା]

remove_diacritics(text, lang)

Removes all diacritics from the text that are not permitted in page names. This removes certain punctuation characters, and replaces letters with diacritics with plain versions, according to the conventions of the given language. For example, macrons are removed from Latin entry names, while vowel diacritics are removed from Hebrew or Arabic terms. These replacements are defined by the entry_name setting for each language in the Module:languages data.

remove_links[ସମ୍ପାଦନା]

remove_links(text)

Replaces all [[wikilinks]] with their linktitle as simple text. This function can be invoked from either a template or from another module.