Template:Allcaps/doc

From HandWiki
< Template:Allcaps
Revision as of 14:42, 17 April 2020 by imported>Andrybak (use Template:Sandbox other)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

{{Allcaps|yOuR tExT}} will (in most browsers) display lower- or mixed-case text in, and (in many browsers) permanently convert it to, full uppercase.

Usage

Your source text will be altered by many browsers (a copy-paste will not give it in its original form):

In: {{Allcaps|The ''Name'' of the Game}}
Out: The Name of the Game
Pasted: Incorrectly as "THE NAME OF THE GAME" or correctly as "The Name of the Game", depending on browser.

You can use this template to control the display of the variable output of magic words and of other templates.

Technical notes

  • This template is a wrapper for <span class="allcaps" style="text-transform: uppercase;">...</span> – This styling is implemented inconsistently in browsers. Firefox copies the unaltered capitalization to the clipboard, while Chrome, Safari, Opera, IE11, and text-only browsers copy all capitals. Case-sensitive searches in Firefox match the unaltered capitalization, so a reader searching for all capitals will not get the expected result. Google and Bing show the unaltered capitalization in search result snippets.
  • This template will corrupt HTML character entities, such as &nbsp;; if a special character much be used in its content, it must be encoded as a decimal character references (e.g. &#160;).
  • Preferably do not subst: it because the result will not be an uppercase source text but the original text wrapped in HTML code making it appear uppercase, so it is more efficient for this purpose to simply rewrite the text in uppercase, or use "{{subst:uc: ...text...}}" to store uppercase text into the page. You can also use the template in edit mode, then copy-paste the result from preview mode into the editing field, replacing the original material and the template.
  • Diacritics (å, ç, é, ğ, ı, ñ, ø, ş, ü, etc.) are handled. However, because the job is performed by each reader's browser, inconsistencies in CSS implementations can lead to some browsers not converting certain rare diacritics.
  • Use of this template does not generate any automatic categorization. As with most templates, if the argument contains an = sign, the sign should be replaced with {{=}}, or the whole argument be prefixed with 1=. And for wikilinks, you need to use piping. There is a parsing problem with MediaWiki which causes unexpected behavior when a template with one style is used within a template with another style.
  • There is a problem with dotted and dotless I. {{Lang|tr|{{Smallcaps|ı i}}}} gives you ı i, although the language is set to Turkish.
  • Do not use this inside Citation Style 1 or Citation Style 2 templates, or this template's markup will be included in the COinS metadata. This means that reference management software such as Zotero will have entries corrupted by the markup. For example, if {{smallcaps}} is used to format the surname of Bloggs, Joe in {{cite journal}}, then Zotero will store the name as <span style="font-variant:small-caps;">Bloggs</span>, Joe. This is incorrect metadata. If the article that you are editing uses a citation style that includes small caps, either format the citation manually (see examples below) or use a citation template that specifically includes small caps in its formatting, like {{Cite LSA}}.

Comparison of the case transformation templates

Template:Case templates table

See also

Magic words that rewrite the output (copy-paste will get the text as displayed, not as entered):

  • {{lc:}} – lower case output of the full text
  • {{uc:}} – upper case output of the full text
  • {{lcfirst:}} – lower case output of the first character only
  • {{ucfirst:}} – upper case output of the first character only