Template:Sc/doc
File:Edit-copy green.svg | This is a documentation subpage for Template:Sc. It contains usage information, categories, interlanguage links and other content that is not part of the original template page. |
File:Ambox warning yellow.svg | This template employs intricate features of template syntax. You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. Remember that you can conduct experiments, and should test all improvements, in either the general Template sandbox or your user space before changing anything here. |
Usage
{{sc}}, named after small caps, is a more robust and consistent WYSIWYG extension of {{Smallcaps}}, backward-compatible in syntax and results. It will rewrite your text using typographical SMALL CAPS. This template is especially useful for name/surname disambiguation in lead sections, and to lighten all-caps words or pronounceable acronyms.
Code | Adolfo {{sc|B|ioy| C|asares}}
|
Displayed | Adolfo BIOY CASARES |
Pasted | Adolfo BIOY CASARES |
Contrary to {{Smallcaps}}, the text will still show the disambiguated "Adolfo BIOY CASARES" (instead of "Adolfo Bioy Casares") in:
- A copy-pasted version of the text.
- A degraded version displayed by a non-CSS browser, or one whose CSS has been disabled, or portable devices such as mobile phones.
- An excerpt as displayed in the results of search engines such as Google.
This preserves the benefit of small caps where they were judged useful.
Code | {{sc|The Lord G|OD| was the L|ORD| in 4004 |BC}}
|
Displayed | The Lord GOD was the LORD in 4004 BC |
Pasted | The Lord GOD was the LORD in 4004 BC |
In this case, the pasted/degraded/excerpted text will retain proper theological caps (instead of the erroneous "The Lord God was the Lord in 4004 bc" that {{Smallcaps}} would give.)
Notes
- An optional parameter,
wrap=no
will prevent the wrapping of a part of the text:
{{sc|wrap=no|4004 |BC}}
- The template will handle up to 20 segments, but could very easily be extended to do twice or more. If you accidentally use more than 20 segments, the template will output an error message in a yellow box like this: 1234567891011121314151617181920Template:sc error: Too many parameters.This will let you know about it instead of having your extra segments be silently ignored.
- The actual process depends on the alternance of odd and even segments (see also the more visual examples):
- Odd segments are outputted verbatim, and displayed with a small caps filter, that is: uppercase letters are outputted uppercase and displayed as regular caps, lowercase letters are outputted as lowercase but displayed as small caps. All other characters are unaltered. A copy-paste of this segment (or a degraded visual on an older browser) will thus display the original text provided to the segment, with its original case. This allows both control of where regular caps will go, and of the contents of copy-paste and degradation.
- Even segments are forced to uppercase for output, and displayed in small caps, that is: whether the source text is uppercase or lowercase doesn't matter here, the output and display will be the same, uppercase letters displayed as small-caps. Note that non-letter signs (especially numbers) shouldn't go in this segment, because they too would be reduced in size.
- Diacritics (å, ç, é, ğ, ı, ñ, ø, ş, ü, etc.) are handled.
- There are dedicated templates {{LORD}} and {{GOD}} for the scriptural use. They are equivalent but streamlined. Preferably do not use {{sc}} for this.
- With a single argument,
{{sc|Your Text}}
is 100% equivalent to{{Smallcaps|Your Text}}
. Thus, {{Smallcaps}} could be redirected to {{sc}} without breaking anything. However, {{Smallcaps}} is not to be redirected to {{sc}}, because there would be no benefit to it, and because the code for {{Smallcaps}} is much shorter to transclude for what it does than the longer code for {{sc}}.
- 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.
Code examples
Display (screen) Output (pasted) |
Code | |
---|---|---|
File:Green check.svg | Sinéad O'CONNOR (born 1966) Sinéad O'CONNOR (born 1966) |
Sinéad {{sc|O'C|onnor}} (born 1966) |
File:Green check.svg | Leonardo DiCAPRIO (born 1974) Leonardo DiCAPRIO (born 1974) |
Leonardo {{sc|DiC|aprio}} (born 1974) |
File:Green check.svg | Adolfo BIOY CASARES is at "B" Adolfo BIOY CASARES is at "B" |
Adolfo {{sc|B|ioy| C|asares}} is at "B" |
File:Green check.svg | José ÁLVAREZ de TOLEDO y GONZAGA José ÁLVAREZ de TOLEDO y GONZAGA |
José {{sc|Á|lvarez| de T|oledo| y G|onzaga}} |
File:Green check.svg | NESBØ, VÅGEN, LOUŸS, ZÚÑIGA, KABAAĞAÇLI NESBØ, VÅGEN, LOUŸS, ZÚÑIGA, KABAAĞAÇLI |
{{sc|N|esbø|, V|ågen|, L|ouÿs|, Z|úñiga|, K|abaağaçlı}} |
File:Green check.svg | THE NAME OF THE 2ND GAME THE NAME OF THE 2ND GAME |
{{sc|T|he| ''N|ame'' of the| 2|<sup>nd</sup>| G|ame}} |
File:Green check.svg | MAO Zedong MAO Zedong |
{{sc|M|ao}} Zedong |
When your text shouldn't be wrapped: | ||
File:Green check.svg | From 4004 BC to 525 AD From 4004 BC to 525 AD |
From {{sc|wrap=no|4004 |BC}} to {{sc|wrap=no|525 |AD}} |
File:Green check.svg | The shortcut is CTRL + ALT + DEL The shortcut is CTRL + ALT + DEL |
The shortcut is {{sc|wrap=no|C|TRL| + A|LT| + D|EL}} |
When your text uses an = sign: | ||
File:Red x.svg | YOU AND MEs | {{sc|Y|ou and| M|e| = U|s}} |
File:Green check.svg | YOU AND ME = US | {{sc|Y|ou and| M|e| <nowiki>=</nowiki> U|s}} |
File:Green check.svg | YOU AND ME = US | {{sc|Y|ou and| M|e| = U|s}} |
File:Green check.svg | YOU AND ME = US | {{sc|Y|ou and| M|e| {{=}} U|s}} |
When your text has a template inside: | ||
File:Red x.svg | in FIDDLER'S GREEN forever | in {{sc|F|iddler's| {{Green|G}}|{{Green|reen}}}} forever |
File:Red x.svg | G}}{{GREEN|REEN}} forever | in {{sc|F|iddler's| {{Green{{!}}G}}|{{Green{{!}}reen}}}} forever |
File:Green check.svg | in FIDDLER'S GREEN forever | in {{sc|1=F|2=iddler's|3={{Green| G}}|4={{Green|reen}}}} forever |
File:Green check.svg | in FIDDLER'S GREEN forever | in {{sc|F|iddler's}} {{Green|1={{sc|G|reen}}}} forever |
When your text is inside a template: | ||
File:Red x.svg | in FIDDLER'S GREEN forever | {{Green|in {{sc|F|iddler's| G|reen}} forever}} |
File:Green check.svg | in FIDDLER'S GREEN forever | {{Green|1=in {{sc|F|iddler's| G|reen}} forever}} |
File:Green check.svg | in FIDDLER'S GREEN forever | {{Colors|green|yellow|3=in {{sc|F|iddler's| G|reen}} forever}} |
When your text uses a | pipe: | ||
File:Red x.svg | AFTER | {{sc|B|efore|{{!}}|afteR}} |
File:Red x.svg | BEFOREafteR | {{sc|B|efore|3={{!}}|afteR}} |
File:Green check.svg | BEFORE|AFTER | {{sc|B|efore|<nowiki>|</nowiki>|afte|R}} |
File:Green check.svg | AFTER | {{sc|B|efore|||afte|R}} |
When your text uses a link: | ||
File:Red x.svg | [[MAO Zedong]] | [[{{sc|M|ao}} Zedong]] |
File:Green check.svg | MAO Zedong | [[Mao Zedong|{{sc|M|ao}} Zedong]] |
Note: some of the "wrong" examples would actually work when used outside of a table, but it is preferable to know and use codes that will work everywhere instead.
Comparison of Template:Smallcaps and Template:sc
At the root, {{sc}} is an extension of {{Smallcaps}}: {{sc|Your Text}}
is exactly equivalent output-wise to {{Smallcaps|Your Text}}
). The differences arise when using the segmented syntax of {{sc}}:
{{Smallcaps}} code |
Display (screen) Output (pasted) |
Display (screen) Output (pasted) |
{{sc}} code
|
---|---|---|---|
The {{Smallcaps|Lord}}
|
The Lord The Lord |
The LORD The LORD |
The {{sc|L|ord}} or: The {{LORD}}
|
Danny {{Smallcaps|DeVito}}
|
Danny DeVito Danny DeVito |
Danny DeVITO Danny DeVITO |
Danny {{sc|DeV|ito}}
|
- Thesis - Advantages of {{sc}} over {{Smallcaps}}
- {{sc}} is WYSIWYG for the copy-pasted text (or degraded text in older browsers, or text snippet in search engines), no more Easter Eggs: output will still give at least "LORD" or "Lord GOD" or "MAO Zedong" or "BC"/"AD" – whereas Smallcaps outputs "Lord" and "Lord God" (theological errors) or "Mao Zedong" (loss of surname disambiguation) or "bc"/"ad" (incorrect).
- {{sc}} does not have the browser-dependent problems with uppercasing diacritics: most of the capitalization is done server-side by the dependable {{uc:}} (and if an error was found, it could be easily fixed in a centralized way by fixing the MediaWiki software).
- Antithesis - Advantages of {{Smallcaps}} over {{sc}}
- {{Smallcaps}} has a simpler call syntax, whereas using {{sc}} beyond a synonym for {{Smallcaps}} requires understanding the segment paradigm, especially on extreme cases:
- José {{Smallcaps|Álvarez de las Asturias de Bohórquez y Goyeneche}}
- José {{sc|Á|lvarez| de las A|sturias| de B|ohórquez| y G|oyeneche}}
- Synthesis - Possible magic word {{sc:}}
However, the only advantage of {{Smallcaps}} is because it relies on the browser parsing the text letter-by-letter, whereas a template such as {{sc}} cannot, and thus need to be told what to do with successive segments.
- A server-side implementation of a new magic word {{sc:}} (on the model of {{lc:}} and {{uc:}}) would make the syntax easy again such as
{{sc:Lord}}
,{{sc:God}}
,{{sc:Mao}} Zedong
,Sinéad {{sc:O'Connor}}
,Adolfo {{sc:Bioy Casares}}
, orDanny {{sc:DeVito}}
(parsing the text based on upper/lower case, as the CSS {{Smallcaps}} does in the browser). - Segments would become optional, and available for when additional control is wanted on the copy-paste/degradation output, such as
{{sc:D|e|Vito}}
(if one wants to output an underlying "DeVITO" instead of "DEVITO", as
{{sc:DeVito}}
would do).
Reasons to use small caps
Small caps are useful for encyclopedical and typographical uses including:
- To lighten ALL-CAPS words or pronounceable acronyms
- To lighten ALL-CAPS surnames mandated by citation styles such as Harvard
- Piccadilly has been compared to "a Parisian boulevard" (DICKENS 1879).
- DICKENS, C., Jr (1879). "Piccadilly" in Dickens's Dictionary of London. London: C. Dickens.[1]
- To disambiguate Western names and surnames at a glance
- Many Hispanic names are tricky to decompose:
- Jorge Luis BORGES, but Adolfo BIOY CASARES (both filed under "B")
- José ÁLVAREZ de las ASTURIAS de BOHÓRQUEZ y GOYENECHE, Marqués de los Trujillos
- And many Hispanic names are better known by their second surname:
- Many names (Martín, Miguel, Ramón, Tomás, etc.) can be either forename or surname:
- Juan Martín HERNÁNDEZ vs. Rafael MARTÍN VÁZQUEZ (two ball players)
- Hungarian names natively use the surname-first order:
- PETŐFI Sándor is usually westernized Sándor PETŐFI
- To disambiguate Eastern surnames and given names at a glance
- Most Chinese names and Korean names retain their surname-first order:
- MAO Zedong fought CHIANG Kai-shek
- The movie Oldboy by PARK Chan-wook starring CHOI Min-sik was not seen by KIM Il-sung
- Most Japanese names are reversed in the West, but not all:
- (Akira KUROSAWA or Motojirō KAJII are usually westernized)
- But MATSUO Bashō, ONO no Komachi, KAGA no Chiyo (haiku poets known under their given name)
- But EDOGAWA Ranpo (kept due to wordplay "EdgarA–llanPoe) vs. Ranpo EDOGAWA (some modern uses)
- Burmese names ignore the concept of forename/surname, but are adapted in the West:
- Daw Aung San SUU KYI, daughter of General AUNG SAN ("Daw" is honorific, her name take part of his name)
- And some Burmese names are so short they need to retain an honorific prefix (U for Mister, Daw for Madam, Thakin for Master) which is confusable with a forename or a surname:
- In chemical nomenclature of sugars and amino acids
Technical code
Technically, any call such as:
x{{sc|L|ord}}x
x{{sc|L|oRd}}x
x{{sc|L|ORD}}x
Will result in the very same code:
x<span style="font-variant:small-caps;">L</span><span style="font-size:80%;">ORD</span>x
That is:
<span style="font-variant:small-caps;"> ... </span>
in the odd segments
<span style="font-size:80%;">{{uc: ... }}</span>
in the even segments
The "font-size:80%" displays a capital at the same height than those generated by "font-variant:small-caps". (The "font-variant:small-caps;text-transform:lowercase" has not been used because it doesn't work at least in Internet Explorer 5 and 6, which are still fairly common browsers.)
See also
Streamlined equivalent versions for very common cases:
Alternative template that only changes the display (copy-paste will get the small-caps as lowercase):
- {{Smallcaps}} – small caps display
Templates that change the display (copy-paste will get the original text):
Magic words that rewrite the output (copy-paste will get the text as displayed):
- {{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