Шаблон:Markup/doc: различия между версиями

Материал из Викимультии — энциклопедии мультипликации
Перейти к навигации Перейти к поиску
[непроверенная версия][отпатрулированная версия]
← Новая страница: «<noinclude>{{docpage}}</noinclude> {{TOC right |limit=2}} Этот шаблон используется, чтобы представить разметку…»
 
Нет описания правки
 
Строка 113: Строка 113:
  | {{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
  | {{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
}}
}}
===См. также===
* {{tl|Markup2}} for bulleted and indented markup.
* {{tl|Markupv}} for the vertical presentation (above/below) of markup/code and its output.
<includeonly>[[Категория: Шаблоны:Для документирования шаблонов]]</includeonly>
<includeonly>[[Категория: Шаблоны:Для документирования шаблонов]]</includeonly>

Текущая версия от 14:52, 5 апреля 2020

Этот шаблон используется, чтобы представить разметку или код рядом с результатом его применения.

Использование[править код]

Каждая ячейка в первой колонке ("Markup") использует <pre>, to retain newlines and spaces but styled to allow content to wrap within it. It is usually desirable to escape the content of these cells so that the markup is displayed by wrapping the markup in <nowiki>. It is technically not possible to add this feature to the template.

Каждая ячейка во второй колонке ("Renders as") скопирована из соответствующей ячейки "разметки" перед ней. Есть случаи, когда это может отличаться:

  • Если первая строка содержит викиразметку, которая должна начать новую строку.
  • Заголовки разметки, такой как == покажет странице оглавления; will show in the page table of contents; use {{fake heading}}.
  • Some templates will place the page in a maintenance category, which is usually undesired:
  • Some templates may have error checking that places the page in a maintenance category. Suppress the category as possible:
    • Шаблон:Cs1 templates can suppress the maintenance category by setting |template doc demo=true.

Ограничение[править код]

<nowiki>[править код]

Если вы не поместите содержимое ячейки разметки в <nowiki>, then any template markup will not be escaped, it will be expanded.

This example shows the markup for {{tl|tag}}:

Renders as Expected rendering
<span class="wp-templatelink">{{</span>[[:Template:tag|tag]]<span class="wp-templatelink">}}</span> 
{{tl|tag}}

HTML entities[править код]

HTML entities are parsed in the markup cell:

Nowikied markup shows as Expected markup
 – 
 –

To work around this, replace the & with & thus &nbsp; will show as  

List and indent markup[править код]

If the first line includes wikimarkup that must start on a new line such as #, * or ; then use <nowiki />:

Without <nowiki />
Разметка Выполнит как
# Item 1
# Item 2
# Item 3
# Item 4 
  1. Item 1
  2. Item 2
  3. Item 3
  4. Item 4
With <nowiki />
Разметка Выполнит как
<nowiki />
# Item 1
# Item 2
# Item 3
# Item 4 

  1. Item 1
  2. Item 2
  3. Item 3
  4. Item 4

Examples[править код]

Simple[править код]

Разметка Выполнит как
'''Bold text''' 
Bold text

''Italic text'' 
Italic text

More complex[править код]

Note that Шаблон:Tl2's second argument here uses Шаблон:Tl2 and Шаблон:Tl2.

Разметка Выполнит как
The quick brown fox jumps over the lazy dog.{{#tag:ref|A footnote.<ref>A reference for the footnote.</ref>|group=nb}} The cow jumped over the moon.{{fact}}

== Notes ==
{{reflist|group=nb}}

== References ==
{{reflist}}
 

The quick brown fox jumps over the lazy dog.[nb 1] The cow jumped over the moon.Шаблон:Fake citation needed

Notes
  1. A footnote.[1]
References
  1. A reference for the footnote.

Multiple rows[править код]

Разметка Выполнит как
The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

With title[править код]

Foxes and dogs
Разметка Выполнит как
The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.

Showing rendered HTML[править код]

When a template is enclosed within {{code}}, it shows the rendered HTML:

Разметка Выполнит как
{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}} 
White T. H. The Book of Merlyn. — 1977.

{{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}} 
White T. H. The Book of Merlyn. — 1977.