Шаблон:Tag: различия между версиями
Перейти к навигации
Перейти к поиску
Andras (обсуждение | вклад) (Новая страница: «{{#ifeq: {{{style|}}} | regular | <templatestyles src="Модуль:Template call code/styles.css" /> }}<{{#ifeq: {{{style|}}} | regular | span | code }} class="{{#ifeq: {{{wrap|}}} | yes | wrap | nowrap }}" style="{{#switch: {{{style|}}} | plain = border:none; background:transparent; | regular = | {{{style|}}} }}"><!-- Opening tag -->{{#switch: {{#if: {{{2|}}} | {{{2|}}} | pair }} |c|close = |s|single |o|open |p|pair = {{#ifeq: {{{1|tag}}} | !-...») |
Andras (обсуждение | вклад) Нет описания правки |
||
| (не показаны 2 промежуточные версии этого же участника) | |||
| Строка 9: | Строка 9: | ||
|s|single | |s|single | ||
|o|open | |o|open | ||
|p|pair = {{#ifeq: {{{1| | |p|pair = {{#ifeq: {{{1|Tag}}} | ||
| !-- | | !-- | ||
| {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><!--</span> | <!-- }} | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><!--</span> | <!-- }} | ||
| {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><</span> | < }}{{{1| | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><</span> | < }}{{{1|Tag}}}{{#if: {{{params|{{{p|}}}}}} |  {{{params|{{{p|}}}}}} }} | ||
}} | }} | ||
}}<!-- | }}<!-- | ||
| Строка 20: | Строка 20: | ||
|s|single =  {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">/></span> | /> }} | |s|single =  {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">/></span> | /> }} | ||
|o|open = {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">></span> | > }}{{{content|{{{c|}}}}}} | |o|open = {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">></span> | > }}{{{content|{{{c|}}}}}} | ||
|p|pair = {{#ifeq: {{{1| | |p|pair = {{#ifeq: {{{1|Tag}}} | !-- || {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">></span> | > }} }}{{{content|{{{c|}}}}}} | ||
}}<!-- | }}<!-- | ||
Closing tag | Closing tag | ||
| Строка 27: | Строка 27: | ||
|o|open = | |o|open = | ||
|c|close | |c|close | ||
|p|pair = {{#ifeq: {{{1| | |p|pair = {{#ifeq: {{{1|Tag}}} | ||
| !-- | | !-- | ||
| {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">--></span> | --> }} | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">--></span> | --> }} | ||
| {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"></</span>{{{1| | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"></</span>{{{1|Tag}}}<span class="ts-templateCallCode-weak">></span> | </{{{1|Tag}}}> }} | ||
}} | }} | ||
}}<!-- | }}<!-- | ||
--></{{#ifeq: {{{style|}}} | regular | span | code }}><noinclude>{{ | --></{{#ifeq: {{{style|}}} | regular | span | code }}><noinclude>{{Doc}}</noinclude> | ||
Текущая версия от 22:58, 13 мая 2023
<Tag></Tag>
Этот шаблон служит для представления XML/HTML-тегов преформатированным способом. В основном используется на страницах обсуждения и документации.
Использование
{{Tag |тег |тип |content=текст |params=параметры |style=стиль/CSS }}
Серым показаны необязательные параметры.
Например,
{{Tag|color}}покажет<color></color>.{{Tag|color|o}}(или:{{Tago|color}}) покажет<color>.{{Tag|color|c}}покажет</color>.{{Tag|nowiki|s}}покажет<nowiki />.
Параметры
- первый параметр (обязательный) — название HTML-тега
- второй параметр — какой тип тега отображать:
p(pair) (по умолчанию) — отображать пару открывающих и закрывающих тегов:<font></font>o(open) — отображать только открывающий тег:<span>- Шорткат:
{{Tago|тег}}
- Шорткат:
c(close) — отображать только закрывающий тег:</span>s(single) — отображать одинарный тег:<nowiki />
- content= или c= — текстовое содержание тегов
- params= или p= — любые параметры для включения в открывающий тег
- style= — стили:
Примеры
{{Tag|ref}}→<ref></ref>{{Tag|ref|content=hello}}→<ref>hello</ref>{{Tag|font|content=foo}}→<font>foo</font>{{Tag|font|open}}→<font>{{Tag|font|open|content=hello}}→<font>hello{{Tag|span|close|content=hello}}→hello</span>{{Tag|span|pair|content=hello}}→<span>hello</span>{{Tag|ref|open|params=group="note"}}→<ref group="note">{{Tag|references|single}}→<references />{{Tag|nowiki|single}}→<nowiki />{{Tag|a|params=href="<nowiki>https://en.wikipedia.org/"|content=English Wikipedia}}</nowiki>→<a href="https://en.wikipedia.org/">English Wikipedia</a>
См. также
- {{#tag}} — функция парсера для генерирования рабочих тегов