Hopp til innhold

Mal:Xyzy

Fra Wiktionary

{{{1}}}

[rediger]

Dokumentasjon
Denne dokumentasjonen er ikke ferdig oversatt til norsk.

Default script template

This is used when a script template is not provided to templates such as {{term}} and {{o}}. It will generate correct attributes and html/xml language tags. If the language is in a set of known languages for which scripts can reasonably be assumed (e.g. "he" language to "Hebr" script) it invokes the specific script template.

This is only to be used by other templates, never in entries; entries should use the correct script template directly if needed.

Parameters

[rediger]
  • (1) text to be tagged
  • språk= language code
  • face= one of [term, ital, head, bold] to set default attributes
  • xspråk= not used as required for all script templates, so caller can avoid "lang=" when blank

The template attempts to handle various combinations of face and lang being specified or not and/or being blank.

  • if språk is blank, the template adds no tagging
  • if språk is missing, it adds tagging for face, if given
  • if språk is not known, it adds tagging for face, if given

There are failure cases, which calling templates should take care to avoid where possible:

  • if lang is missing, and face is invalid, it will generate blank lang tags (believed to be legal, but not desirable)
    Not exactly. In XHTML 1.0 Transitional (which we use), lang="" and xml:lang="" are both invalid, in that they violate the DTD (these attributes are of type NMTOKEN, which the XML 1.0 spec defines as (NameChar)+). However, XML 1.0 does define semantics for xml:lang="", saying basically that it explicitly overrides the xml:lang of an enclosing element, but without providing a new value.[1] Those semantics actually apply pretty well for us: the enclosing context is in English, but the quoted word is likely not to be. The question is, are the semantics even relevant, given that it's not valid? —RuakhTALK 18:52, 11 July 2009 (UTC)
  • lang and face are partially mixed together, so things like {{Xyzy}} and {{Xyzy}} have interesting effects (in this case, <>foo</> and {{|1=foo|face=he|språk={{{språk}}}}}, respectively)
  • if språk is invalid, it will generate bad lang tags (not checked)

Examples

[rediger]

(see page source in your browser)

  • {{Xyzy|foo}}: foo
  • {{Xyzy|foo|face=bold}}: foo
  • {{Xyzy|foo|face=ital}}: foo
  • {{Xyzy|foo|face=term}}: foo
  • {{Xyzy|字典|språk=cmn}}: 字典
  • {{Xyzy|字典|språk=ja}}: 字典
  • {{Xyzy|พจนานุกรม|språk=th|face=head}}: พจนานุกรม

Bad examples:

  • {{Xyzy|foo|face=bogus}}: foo
  • {{Xyzy|foo|lang=xx-zz}}: foo

Languages

[rediger]
kode språk script
ar arabisk Arab
fa persisk fa-Arab
hy armensk Armn
be belarusisk Cyrl
bg bulgarsk Cyrl
mk makedonsk Cyrl
ru russisk Cyrl
uk ukrainsk Cyrl
sa sanskrit Deva
hi hindi Deva
el gresk Grek
grc gammelgresk polytonic
he hebraisk Hebr
yi jiddisch Hebr
arc arameisk Hebr
ja japansk Jpan
ko koreansk Kore
ta tamilsk Taml
te telugu Telu
th thai Thai

Notes

[rediger]

The name comes from the magic word "xyzzy" from Adventure. It is made to look like an ISO script name, but one very unlikely to be assigned.

It maybe very tempting to add languages and scripts, but it should be avoided! Each one adds overhead to many calls on a large majority of the wikt pages, and the benefits for languages beyond what is already there are minimal. Any such change must be very carefully considered.

Tests

[rediger]