Module:script utilities/doc
This is the documentation page for Modulus:script utilities
Subpagina haec est documentatio de Module:script utilities. Hic legitur quomodo uti, ac categoriae, nexus invervici et cetera continentur qui module in origine non continet. |
Purpose
+/-This module provides access to Module:scripts from templates, so that they can make use of the information stored there. It also provides a number of functions that can be used by other modules.
Data is found in Module:script utilities/data.
Exported functions
+/-lang_t
+/-{{#invoke:script utilities|lang_t}}
This is used by {{lang}}
to wrap portions of text in a language tag. See there for more information.
tag_text
+/-tag_text(text, lang, sc, face, class)
Wraps the given text in HTML tags with appropriate CSS classes (see WT:CSS) for the language and script. This is required for all non-English text on Wiktionary.
The actual tags and CSS classes that are added are determined by the face
parameter. It can be one of the following:
"term"
- The text is wrapped in
<i class="(sc) mention" lang="(lang)">...</i>
. "head"
- The text is wrapped in
<strong class="(sc) headword" lang="(lang)">...</strong>
. "hypothetical"
- The text is wrapped in
<span class="hypothetical-star">*</span><i class="(sc) hypothetical" lang="(lang)">...</i>
. "bold"
- The text is wrapped in
<b class="(sc)" lang="(lang)">...</b>
. nil
- The text is wrapped in
<span class="(sc)" lang="(lang)">...</span>
.
The optional class
parameter can be used to specify an additional CSS class to be added to the tag.
tag_translit
+/-tag_translit(translit, lang, kind, attributes)
Tags the transliteration for given text translit
and language lang
. It will add the language, script subtag (as defined in BCP 47 2.2.3) and dir (directional) attributes as needed.
The optional kind
parameter can be one of the following:
"term"
- tag transliteration for
{{mention}}
"usex"
- tag transliteration for
{{usex}}
"head"
- tag transliteration for
{{head}}
"default"
- default
The optional attributes
parameter is used to specify additional HTML attributes for the tag.
request_script
+/-request_script(lang, sc)
Generates a request to provide a term in its native script, if it is missing. This is used by the {{rfscript}}
template as well as by the functions in Module:links.
The function will add entries to one of the subcategories of Category:Terms needing native script by language, and do several checks on the given language and script. In particular:
- If the script was given, a subcategory named "needing (script) script" is added, but only if the language has more than one script. Otherwise, the main "needing native script" category is used.
- Nothing is added at all if the language has no scripts other than Latin and its varieties.
template_rfscript
+/-{{#invoke:script utilities|template_rfscript}}
This is used by {{rfscript}}
. See there for more information.
See also
+/-- Module:scripts — script related code
- Module:scripts/data — script data module
- Module:JSON data — for exporting all the script data at once