Help:Lint hataları/html5-misnesting
Giriş Vikimetin
<span>a
b</span>
Tidy çıkış
Tidy PHP ayrıştırıcı çıkışını temizleyerek oluşturur
<p><span>a</span></p>
<p><span>b</span></p>
HTML5 çıkış (örn: Parsoid, RemexHTML)
Ancak, HTML5 tabanlı bir araç, PHP ayrıştırıcı çıkışını farklı şekilde temizleyerek oluşturur
<p><span>a</span></p>
<p>b</p>
Önerilen düzeltme
Vikimetini şu şekilde değiştirin:
<span style="...">a</span>
<span style="...">b</span>
or to:
<div style="...">
a
b
</div>
Diğer ipuçları
Bazen sayfalar HTML5 ve HTML4'te farklı oluşturmaya sahip yanlış iç içe geçmiş etiket adı verilen hata grubuna yerleştirilir, oysa asıl sorun rastgele bir açılış veya kapanış etiketidir.
Düzeltmeye çalıştığınız sayfada eksik bitiş etiketi veya kaldırılmış etiket hataları varsa, öncelikle hepsini düzeltin; yanlış yerleştirilmiş etiket hatası bu düzeltmeler sonucunda ortadan kalkabilir.
Bazen, gerçek hata olmasına rağmen eksik bitiş etiketi hatası gösterilmez bile (aşağıda "Bu satır ... vurgulanmıştır " ile başlayan kullanım örneğine bakın).
Bunun viki sayfalarını etkilemesinin başlıca yollarından biri, bir listeyi sarmak için bir span etiketinin (veya aşağıdaki etkilenen etiketler listesindeki herhangi bir etiket) kullanılmasıdır. PHP ayrıştırıcısındaki bir hata (düzeltilmesi zor ve pwrap-bug-workaround linter kategorisinin nedenidir. Parsoid'de bu hata yoktur) ile HTML5 ayrıştırma spesifikasyonu arasındaki etkileşimler nedeniyle, Tidy kaldırıldığında bu sarmalayıcılar artık listeye uygulanmayacaktır.
Bir listeyi sarmak için <span> etiketi kullanıldığında, bunun yerine <div> etiketini kullanın.
It is the correct way to do it since a list is a block structure and <div> is more appropriate instead of <span> which makes more sense in inline text contexts.
This is the recommended fix.
See this edit on the italian wikipedia for an example.
But, where appropriate, consider fixes like those in the table below.
| Use case | Alternative markup or suggested fix |
|---|---|
<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