Help:Lint errors/html5-misnesting/ja
Input Wikitext
<span>a
b</span>
Tidy の出力
Tidy cleans up the PHP parser output to generate
<p><span>a</span></p>
<p><span>b</span></p>
HTML5 の出力 (例: Parsoid, RemexHTML)
But, a HTML5 based tool cleans up the PHP parser output differently to generate
<p><span>a</span></p>
<p>b</p>
Recommended fix
Change the wikitext to:
<span style="...">a</span>
<span style="...">b</span>
or to:
<div style="...">
a
b
</div>
Other tips
ページによっては、実際の問題が不要な開始タグまたは終了タグであるにもかかわらず、HTML5とHTML4のレンダリングの差異によって誤った入れ子構造となっているタグ という名前のエラー グループに分類されることがあります。
修正しようとしているページに 不足している終了タグ や タグを省略 のエラーがある場合は、それらをすべて先に修正してください。それによって、タグの入れ子構造の誤りエラーが解消される可能性があります。
場合によっては、実際の原因が 不足している終了タグ エラーであっても、それが表示されないことがあります (以下の「この行が強調されている…」で始まる使用例を参照してください)。
これがウィキ ページに影響を及ぼす主な例の 1 つは、span (または下記の影響を受けるタグの一覧にある他のタグ) を使って箇条書きを囲んだ場合です。 PHP パーサーのバグ (修正が難しく、pwrap-bug-workaround の Lint カテゴリが存在する理由です。Parsoid にはこのバグはありません) と HTML5 の構文解析仕様の相互作用により、Tidy が除去されると、これらのラッパーはリストに適用されなくなります。
リストを囲むのに <span> タグが使われている場合は、代わりに <div> タグを使用してください。
リストはブロック構造であるため、これが正しい方法です。<span> はインライン テキスト向けの文脈で使う方が適切であり、<div> の方が適しています。
これは推奨される修正です。
例として、イタリア語版ウィキペディアでのこの編集を参照してください。
ただし、適切な場合は、下の表のような修正も検討してください。
| 使用事例 | 代替マークアップまたは推奨修正 |
|---|---|
<span> tag used for formatting (font-size, underline, etc.)
|
Use the appropriate formatting tag (ex: <small> tag if reducing font-size Example from metawiki)
|
<del> tag wrapping a list to strike through elements of a list
|
|
<span> tag with empty styles
|
Get rid of the span tag |
<span> tag wrapping block tags in all cases
|
Use a <div> tag instead (add style="display:inline;" if a line break is undesirable)
|
Template that uses <span> tags wrapping a template that uses <div> tags
|
Change the wrapper template to use <div> tags, as long as the wrapper template is never used inside span tags. OR If the wrapper template applies a class like nowrap, apply that class within the inner template instead.
|
<span style="font-size: 80%"><sup>2</sup>Lorem ipsum etc.
|
This line is highlighted as a misnesting error, but the actual problem is a missing span tag at the end of the line. Add the missing end tag (or remove the opening tag, if it is extraneous) to fix the problem. |
You need to use a <span> tag to do that....
|
An editor has typed a tag as an example, but they should have escaped it. Replace the opening < character with <.
|
This is an <abbr>abbreviation<abbr> (trailing opening tag inserted by mistake)
|
An editor has typed a set of opening and closing tags, but they failed to insert a / into the closing tag. Replace the final <abbr> tag with </abbr>.
|
| Pipe character used in a signature | If an editor used a pipe (vertical line, |) character in their signature along with markup or tags, and that signature was used inside a template, the pipe is being interpreted as separating template parameters. Replace the pipe with |
|
Pay special attention to <sub>, <sup>
On pages with mathematical formulae, misnesting of a sub or sup tag might subtly change the meaning of the formula.
It is important to fix these cases.
See this example from enwiki.
Affected tags
The following tags are affected.
ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, KBD, MARK,
Q, RB, RP, RT, RTC, RUBY, SAMP, SPAN, SUB, SUP, TIME, VAR