Шаблон:Tag: различия между версиями
Перейти к навигации
Перейти к поиску
Dzmuh (обсуждение | вклад) (Новая страница: «<{{#ifeq: {{{style|}}} | regular | span | code }} class="{{#ifeq: {{{wrap|}}} | yes | wrap | nowrap }}" style="{{#switch: {{{style|}}} | plain = border:none; back...») |
Dzmuh (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
<{{#ifeq: {{{style|}}} | regular | span | code }} class="{{#ifeq: {{{wrap|}}} | yes | wrap | nowrap }}" style="{{#switch: {{{style|}}} | {{#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; | | plain = border:none; background:transparent; | ||
| regular = | | regular = | ||
| Строка 11: | Строка 11: | ||
|p|pair = {{#ifeq: {{{1|tag}}} | |p|pair = {{#ifeq: {{{1|tag}}} | ||
| !-- | | !-- | ||
| {{#ifeq: {{{style|}}} | regular | <span class=" | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><!--</span> | <!-- }} | ||
| {{#ifeq: {{{style|}}} | regular | <span class=" | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak"><</span> | < }}{{{1|tag}}}{{#if: {{{params|{{{p|}}}}}} |  {{{params|{{{p|}}}}}} }} | ||
}} | }} | ||
}}<!-- | }}<!-- | ||
| Строка 18: | Строка 18: | ||
-->{{#switch: {{#if: {{{2|}}} | {{{2|}}} | pair }} | -->{{#switch: {{#if: {{{2|}}} | {{{2|}}} | pair }} | ||
|c|close = {{{content|{{{c|}}}}}} | |c|close = {{{content|{{{c|}}}}}} | ||
|s|single =  {{#ifeq: {{{style|}}} | regular | <span class=" | |s|single =  {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">/></span> | /> }} | ||
|o|open = {{#ifeq: {{{style|}}} | regular | <span class=" | |o|open = {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">></span> | > }}{{{content|{{{c|}}}}}} | ||
|p|pair = {{#ifeq: {{{1|tag}}} | !-- || {{#ifeq: {{{style|}}} | regular | <span class=" | |p|pair = {{#ifeq: {{{1|tag}}} | !-- || {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">></span> | > }} }}{{{content|{{{c|}}}}}} | ||
}}<!-- | }}<!-- | ||
Closing tag | Closing tag | ||
| Строка 29: | Строка 29: | ||
|p|pair = {{#ifeq: {{{1|tag}}} | |p|pair = {{#ifeq: {{{1|tag}}} | ||
| !-- | | !-- | ||
| {{#ifeq: {{{style|}}} | regular | <span class=" | | {{#ifeq: {{{style|}}} | regular | <span class="ts-templateCallCode-weak">--></span> | --> }} | ||
| {{#ifeq: {{{style|}}} | regular | <span class=" | | {{#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>{{doc}}</noinclude> | --></{{#ifeq: {{{style|}}} | regular | span | code }}><noinclude>{{doc}}</noinclude> | ||
Текущая версия от 17:13, 3 мая 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}} — функция парсера для генерирования рабочих тегов