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

Шаблон:Var/док

Iz Vojne Enciklopedije

{{#ifeq:док |док

    | 

{{#ifeq:show |show

|

        }}{{#if: |
         |   {{#ifexist:Шаблон:Var
                  | [[Категорија:Документација {{#switch:Шаблон |Шаблон=шаблона |Модул=модула |Корисник=корисничких страница |#default=Википедије}}]]
                  | 
                 }}
        }}
    | 
   }}

This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup in template documentation, metasyntactic variables, etc.) with the semantically correct {{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <var{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </var>

}} tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the {{#switch:o

|c|close  = 
|s|single
|o|open
|p|pair   = <var{{#if:| {{{params}}}}}

}}{{#switch:o

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:o

|s|single
|o|open   = 
|c|close
|p|pair   = </var>

}} element has semantic meaning, while simple italicization does not. This template provides a tiny hint of kerning to compensate for the italicization and enhance readability.

"Variable" in this sense may include arbitrary or unknown names or terms, examples of human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally not used if MediaWiki's {{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <math{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </math>

}} tags (or any other stand-alone mathematical markup) are being used.

Example
{{#if: |}}{{#if:yes | |{{#if:|}} }}{{#if: |}}{{#if: |}}{{#if: | |{{}}{{#if: |subst:}}{{#if:yes |}}{{#if: || {{#if: |{}}[[:{{#ifeq:v|: |Var |{{#switch:
                        |  = Шаблон:{{#if:var|Var|Var/док}}
                        | #default = {{#if:var|Var|Шаблон:Var/док}}
                     }}}}|}}{{#if: |{{}}{{#if: |{}}{{#if:var|var|{{#ifeq:Шаблон|Шаблон|Var/док|Шаблон:Var/док}}}}{{#if: |}}}}{{#if: |}}}{{#if: | |]]{{#if: |}}}}}{{#if:yes |}}{{#if: |}}{{#if: |}}{{#ifeq:username|¬ | ||username}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#ifeq:|¬ | ||}}{{#if: ||…}}{{#if: |}}{{#if: | |}}}}{{#if: |}}{{#if:yes |}}{{#if: |}}

outputs the following HTML:

{{#switch:pair
|c|close  = 
|s|single
|o|open
|p|pair   = <var{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = username
|s|single =  />
|o|open   = >username
|p|pair   = >username

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </var>

}} which renders as:

username

Note that on the screen or in print, this renders as simple italicization, as does ''username'' (using pairs of apostrophes) or {{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <i{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = username
|s|single =  />
|o|open   = >username
|p|pair   = >username

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </i>

}} (using HTML), yet it carries more semantic meaning than either of these methods.

At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if: |замени:}}varserif{{#if: ||{{{2}}}}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||{{{12}}}}}{{#if: ||{{{13}}}}}{{#if: ||{{{14}}}}}{{#if: ||{{{15}}}}}{{#if: ||{{{16}}}}}{{#if: ||{{{17}}}}}{{#if: ||{{{18}}}}}{{#if: ||{{{19}}}}}{{#if: ||{{{20}}}}}{{#if: ||...}}}} template instead of {{{{#ifeq:var|var|var|var}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}}}, to make them more distinguishable, like these serif examples: I, l.

More examples
{{#if: ||+ {{{title}}}}} {{#if: |
Викиозначавање Резултат у чланку

}}{{#if:The HTML code: : <code>{{tag|var|content=username}}</code> renders as: : {{var|username}}|

The HTML code:
: <code>{{tag|var|content=username}}</code> 
renders as: 
: {{var|username}}

The HTML code:

{{#switch:pair
close = single open pair = <var{{#if:| {{{params}}}}}

}}{{#switch:pair

close = username single = /> open = >username pair = >username

}}{{#switch:pair

single open = close pair = </var>

}} renders as:

username

}}{{#if:The commandline should read: {{samp|%}} {{kbd|1=ssh {{var|hostname}}}}<br />(where {{var|hostname}} is the IP address or ...)<br />If it is correct, press {{key press|Enter}}.|

The commandline should read: {{samp|%}} {{kbd|1=ssh {{var|hostname}}}}<br />(where {{var|hostname}} is the IP address or ...)<br />If it is correct, press {{key press|Enter}}.

The commandline should read: % ssh hostname
(where hostname is the IP address or ...)
If it is correct, press {{#switch:enter

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = Enter

}}{{#if:|+{{#switch:{{{2}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{2}}}

}}}}{{#if:|+{{#switch:{{{3}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{3}}}

}}}}{{#if:|+{{#switch:{{{4}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{4}}}

}}}}{{#if:|+{{#switch:{{{5}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{5}}}

}}}}{{#if:|+{{#switch:{{{6}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{6}}}

}}}}{{#if:|+{{#switch:{{{7}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{7}}}

}}}}{{#if:|+{{#switch:{{{8}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{8}}}

}}}}{{#if:|+{{#switch:{{{9}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{9}}}

}}}}{{#if:|+{{#switch:{{{10}}}

caps lock = Caps Lock caps lock = Caps Lock shift = Shift shift = Shift enter = Enter enter = Enter cmd = Cmd cmd cmd = Cmd command = Command command command = Command opt = Opt opt opt = Opt option = Option option key option option = Option tab = Tab tab = Tab backspace = ← Backspace backspace = ← Backspace win = Win win win = Win menu = Menu menu = Menu up = ↑ up = down = ↓ down = left = ← left = right = → right = * asterisk = * # hash = # # = # : colon = : [[:]] = : pipe = | [[|]] = | ; semicolon = ; ; = ; equals = = l-up l up = L↑ l-down l down = L↓ l-left l left = L← l-right l right = L→ l-ne l ne = L↗ l-se l se = L↘ l-nw l nw = L↖ l-sw l sw = L↙ r-up r up = R↑ r-down r down = R↓ r-left r left = R← r-right r right = R→ r-ne r ne = R↗ r-se r se = R↘ r-nw r nw = R↖ r-sw r sw = R↙ ps x ex = × ps c circle = ps s square = ps t triangle = c-up c up = C↑ c-down c down = C↓ c-left c left = C← c-right c right = C→ c-ne c ne = C↗ c-se c se = C↘ c-nw c nw = C↖ c-sw c sw = C↙ #default = {{{10}}}

}}}}{{#if:|}}.

}}{{#if:in this equation, let {{var|x}}{{=}}1 and {{var|y}}{{=}}120 ...|

in this equation, let {{var|x}}{{=}}1 and {{var|y}}{{=}}120 ...

in this equation, let x=1 and y=120 ...

}}{{#if:{{para|accessdate|{{var|todays_date}}}}|

{{para|accessdate|{{var|todays_date}}}}

|{{SAFESUBST:#if:accessdate|accessdate=}}todays_date

}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}{{#if:|


}}