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

Материал из Народные сказки
Перейти к навигации Перейти к поиску
мНет описания правки
 
Строка 9: Строка 9:
Каждая ячейка во второй колонке ("Renders as") скопирована из соответствующей ячейки "разметки"  перед ней. Есть случаи, когда это может отличаться:
Каждая ячейка во второй колонке ("Renders as") скопирована из соответствующей ячейки "разметки"  перед ней. Есть случаи, когда это может отличаться:
* Если первая строка содержит викиразметку, которая должна начать новую строку.
* Если первая строка содержит викиразметку, которая должна начать новую строку.
* Заголовки разметки, такой как {{Code|1===}} покажет  странице оглавления; will show in the page table of contents; use {{Tcl|Fake heading}}.
* Заголовки разметки, такой как {{Code|1===}} покажет  странице оглавления; will show in the page table of contents; use {{Tcl|Фальшзаголовки}}.
* Some templates will place the page in a maintenance category, which is usually undesired:
* Some templates will place the page in a maintenance category, which is usually undesired:
** Instead of {{Tcl|citation needed}}, use {{Tcl|Fake citation needed}}.
** Instead of {{Tcl|citation needed}}, use {{Tcl|Fake citation needed}}.
Строка 71: Строка 71:


====More complex====
====More complex====
Note that {{Tl2|Markup}}'s second argument here uses {{Tl2|Fake heading}} and {{Tl2|Fake citation needed}}.
Note that {{Tl2|Markup}}'s second argument here uses {{Tl2|Фальшзаголовки}} and {{Tl2|Fake citation needed}}.
{{Markup
{{Markup
| <nowiki>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}}
| <nowiki>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}}
Строка 83: Строка 83:
| 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.{{Fake citation needed}}
| 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.{{Fake citation needed}}


{{Fake heading|sub=2|Notes}}
{{Фальшзаголовки|sub=2|Notes}}
{{Примечания|group=nb}}
{{Примечания|group=nb}}


{{Fake heading|sub=2|References}}
{{Фальшзаголовки|sub=2|References}}
{{Примечания|close}}
{{Примечания|close}}
}}
}}

Текущая версия от 19:22, 1 марта 2024

Ошибка Lua в Модуль:Message_box на строке 113: attempt to index field 'cfg' (a nil value). Этот шаблон используется, чтобы представить разметку или код рядом с результатом его применения.

Использование

Каждая ячейка в первой колонке ("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 {{Фальшзаголовки}}.
  • 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="ts-templateCallCode"><span class=" ts-templateCallCode-opening ts-templateCallCode-weak">{{</span><span class="ts-templateCallCode-templateName" data-navboxnavigation-link="0">[[:Template:Tag|Tag]]</span><span class=" ts-templateCallCode-closing ts-templateCallCode-weak">}}</span></span> 
{{Tl|Tag}}

HTML entities

HTML entities are parsed in the markup cell:

Nowikied markup shows as Expected markup
 – 
&nbsp;&ndash;

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

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 ==
{{Примечания|group=nb}}

== References ==
{{Примечания}}
 

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:

Разметка Результат
{{Книга |заглавие=The Book of Merlyn |год=1977 |язык=en |автор=White, T. H.}} 
White, T. H. The Book of MerlynШаблон:ref-en. — 1977.
{{Code|{{Книга |заглавие=The Book of Merlyn |год=1977 |язык=en |автор=White, T. H.}}}} 
<span class="citation no-wikidata" data-wikidata-property-id="P1343" ><i>White, T. H.</i>&#32;The Book of Merlyn[[:Шаблон:ref-en]].&nbsp;— 1977.</span>