Help:Lint errors/self-closed-tag/ru

From mediawiki.org
This page is a translated version of the page Help:Lint errors/self-closed-tag and the translation is 57% complete.

Страницы в этом списке содержат некорректные самозакрывающиеся HTML-тэги, такие как ‎<b />, ‎<div />, ‎<span />, ‎<p />, ‎<td />. (Корректные тэги, определённые в спецификации HTML5, такие как ‎<br />, ‎<hr />, ‎<wbr />, не вызывают эту ошибку.)[1][2] The behavior of these invalid tags changes in MediaWiki 1.35 (deployed on Wikimedia 2–4 June 2020), to be consistent with the HTML5 specification, so their use in wikitext is deprecated. См. phab:T134423 для подробностей.

Pages are also automatically placed on this list by malformed tags like </center/>, which should usually be changed to ‎</center> (remove the final slash); or by malformed constructs like <s>...<s/>, which should usually be changed to ‎<s>...‎</s> (move the slash from end to beginning of the closing tag).

Where an invalid ‎<font /> or ‎<span /> (with no attributes such as id= or class=) is used as a spacer to prevent wikicode from rendering in example code, like {<font/>{templatename}}, either replace ‎<font /> with ‎<nowiki /> for valid code that achieves the same effect, or use a template-linking template such as {{tl}} or {{tlx}}, as in {{tlx|templatename}}.

Некоторые шаблоны включают параметр |id= для якоря. When fixing self-closed <div id="..." /> and <span id="..." /> tags that appear immediately before such templates, consider moving the anchor text from the HTML tag to inside the template and removing the now-unneeded tag.

Если на данной странице в этом списке нет некорректный самозакрывающихся тэгов, она может включать страницу или шаблон на которой они есть.

Пример

Некорректная разметка
<div> abc <div/>
Корректная разметка
<div> abc </div>

Примечания

  1. The full list of valid self-closing tags in HTML5 is: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, and wbr. However, only ‎<br />, ‎<hr />, ‎<wbr /> are allowed through the parser. The HTML pre tag is superseded by the MediaWiki XML pre tag.
  2. Некоторые XML-тэги MediaWiki также корректны, будучи самозакрывающимися, такие как ‎<nowiki /> и ‎<pre />, аналогично некоторые тэги расширений, такие как ‎<ref /> и ‎<references />.

Инструменты

The following tools can help fix invalid self-closed HTML tags:

См. также