Шаблон:Var

Материал из Викиновостей, свободного источника новостей

{{{1}}}

Документация

Шаблон {{var}} используют для отображения имён переменных (в математике, в исходном коде компьютера, в документации шаблонов и т. д.) с семантически корректным кодом, помещая этот код в контейнер <var></var>, который браузеры, как правило, выделяют курсивным начертанием. Этот метод из соображения семантичности является более предпочтительным, чем простое выделение текста курсивом.

Переменная в этом смысле может включать в себя произвольные или неизвестные имена или термины, арифметические переменные в уравнениях, и т. д. Этот шаблон в XHTML, не используется, если в MediaWiki <math></math> применяются теги (или любая другая автономная математическая разметка).

Формат: {{var|текст}}

not

Примеры
{{var|username}}

выводит следующий HTML:

<var>username</var> который отображается, как: username

Note that on the screen or in print, this renders as simple italicization, as does ''username'' (using pairs of apostrophes) or <i>username</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 {{varserif}} template instead of {{var}}, to make them more distinguishable, like these serif examples: I, l.

More examples:

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

<var>username</var>username

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 ↵ Enter.

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

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