Пређи на садржај

Шаблон:Var serif/док — разлика између измена

нема описа измене
(Нова страница: {{Documentation subpage}} <!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> This template is to help facilitate the displaying of variable name…)
 
Нема описа измене
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
==Usage==
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, etc.) with the semantically correct <code><nowiki><var>...</var></nowiki></code>, which also renders the variable in italics, as is customary, <em>''and</em>'' to do so in a serif font. This is ''specifically'' for the use of the characters "I" (upper-case i) and "l" (lower-case L), which in many sans-serif fonts can be difficult to distinguish. The template also very slightly adjusts the font size of the enclosed variable, to account for typical difference in [[x-height]] between non-fancy serif (e.g., Times and Times New Roman) and sans-serif (e.g. Arial and Helvetica) typefaces. The template should not be used generally, but only for "I" and "l", and perhaps other cases where a known visual ambiguity can be shown to exist in common sans-serif fonts for readers without acute vision. It is recommended to use {{tlx|var|1}} rather than {{tlx|varserifvar serif|1}} for "1" (numeral one), as it is usually more clearly distinguishable from "I" and "l" in sans-serif than serif fonts.
 
{{tlx|VarserifVar serif}} need not be used for variables that simply ''contain'' "I" or "l", only for cases in which readers are likely to be unable to distinguish them visually.
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, etc.) with the semantically correct <code><nowiki><var>...</var></nowiki></code>, which also renders the variable in italics, as is customary, <em>and</em> to do so in a serif font. This is ''specifically'' for the use of the characters "I" (upper-case i) and "l" (lower-case L), which in many sans-serif fonts can be difficult to distinguish. The template also very slightly adjusts the font size of the enclosed variable, to account for typical difference in [[x-height]] between non-fancy serif (e.g., Times and Times New Roman) and sans-serif (e.g. Arial and Helvetica) typefaces. The template should not be used generally, but only for "I" and "l", and perhaps other cases where a known visual ambiguity can be shown to exist in common sans-serif fonts for readers without acute vision. It is recommended to use {{tlx|var|1}} rather than {{tlx|varserif|1}} for "1" (numeral one), as it is usually more clearly distinguishable from "I" and "l" in sans-serif than serif fonts.
 
The {{tlx|varserifvar serif}} method is preferred to simply italicizing and using inline style to specify the font, for [[WP:Accessibility|accessibility]], [[Separation of presentation and content|content/presentation separation]], [[semantic Web]], and [[WP:METADATA|metadata]] reasons; XHTML's <code><nowiki><var></nowiki></code> element has semantic meaning, while simple font changes like italicizing does not.
{{tlx|Varserif}} need not be used for variables that simply ''contain'' "I" or "l", only for cases in which readers are likely to be unable to distinguish them visually.
 
The {{tlx|varserif}} method is preferred to simply italicizing and using inline style to specify the font, for [[WP:Accessibility|accessibility]], [[Separation of presentation and content|content/presentation separation]], [[semantic Web]], and [[WP:METADATA|metadata]] reasons; XHTML's <code><nowiki><var></nowiki></code> element has semantic meaning, while simple font changes like italicizing does not.
 
Because the font styling in the template is done entirely with [[Cascading Style Sheets|CSS]], it has no effect at all upon content semantics, nor does it change the output for users of [[screen reader]] software.
 
Example:
: <code><nowiki>{{varserifvar serif|I}}</nowiki></code>
outputs:
: <code><nowiki><var style="font-size:118%;font-family:serif;">I</var></nowiki></code>
which renders as:
: {{varserifvar serif|I}}
 
;Comparisons:
: <code><nowiki>{{var|l}}</nowiki></code> = {{var|l}}
: <code><nowiki>{{var|1}}</nowiki></code> = {{var|1}}
: <code><nowiki>{{varserifvar serif|I}}</nowiki></code> = {{varserifvar serif|I}}
: <code><nowiki>{{varserifvar serif|l}}</nowiki></code> = {{varserifvar serif|l}}
: <code><nowiki>{{varserifvar serif|1}}</nowiki></code> = {{varserifvar serif|1}}
 
Please note that {{tnull|varserifvar serif}} is not a panacea; its treatment of the numeral "1" is easily mistaken for the letter "l" (lower-case "L") in many serif fonts.
 
; Recommended usage:
: <code><nowiki>{{varserifvar serif|I}}</nowiki></code> = {{varserifvar serif|I}}
: <code><nowiki>{{varserifvar serif|l}}</nowiki></code> = {{varserifvar serif|l}}
: <code><nowiki>{{var|1}}</nowiki></code> = {{var|1}}
: <code><nowiki>{{var|</nowiki>{{var|variable}}<nowiki>}}</nowiki></code> for any other variable
 
==TemplateData==
{{TemplateDataHeader}}
<templatedata>
{
"params": {
"1": {},
"class": {},
"id": {},
"style": {},
"lang": {},
"title": {}
}
}
</templatedata>
 
{{Semantic markup templates}}
 
<includeonly>{{Sandbox other||
<!-- CATEGORIESCategories BELOWbelow THISthis LINE,line; PLEASE:interwikis at Wikidata -->
[[Category:MathematicsMathematical formatting templates]]
[[Category:Programming typing-aid templates]]
[[Category:Semantic markup templates]]
[[Category:Wikipedia XHTML tag-replacing templates]]
}}</includeonly>