Jump to content

Help:Lintエラー/misnested-tag

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

タグの入れ子構造の誤りの警告は、一部のタグやウィキテキストマークアップが親要素の外で閉じられ、タグやマークアップが重なっている際に発生します。このLinterカテゴリは、誤った入れ子構造となっている事例の修正を支援するために追加されました。 現在、これは警告として扱われます。

例1:

<b> foo <i> bar </b> baz </i>

例2:

''' foo '' bar ''' baz ''

例3:

* a
* b <small> c
* d </small>
* e

例4:

<small> foo
* a
* b
bar </small>

例5:

''<span>foo''</span>

例6:

<span>foo<br/>
bar</span>

例1と例2では、(HTMLやウィキテキストの形の)‎<i> タグは、‎<b> タグの中に適切に入れられている必要があります。パーサーはこれを修正しますが、編集者が意図した結果が出力されるとは限りません。

例3では、‎<small> タグは2行目で一度閉じ、3行目でもう一度開く必要があります。

In Example 4 (which is sometimes reported as one missing end tag and one stripped tag), HTML5 semantics require the ‎<small> tag (and other formatting tags limited to phrasing content, like ‎<span>、​‎<strike>、​‎<em>、​‎<i>, etc.) to be wrapped around individual elements. To fix this problem, use a ‎<div> tag to wrap lists. For common usages such as the small tag, templates such as Template:Smalldiv on English Wikipedia can make such replacements easier.

In Example 5, much like previous examples, the output is invalid because that wikitext would expand to <i><span>foo</i></span>. The ‎<i> pair should be either inside or outside the span, e.g. <span>''foo''</span>.

In Example 6, a span tag is wrapped around a line break. Possible resolutions are to remove the manual line break (using a br tag if desired) or wrap each line in its own span tags.

Some templates apply italic formatting to fields like "title" or "magazine". To add an unitalicized note to a field of that type, use {{Noitalic }} around the note.

ツール

以下のツールは、タグの入れ子構造の誤りを修正するのに役立ちます。

関連項目