File.html
word<i><span> <span>ratti</span></span></i>
命令
$ tidy File.html
输出
word<i>ratti</i>
期望的输出
word<i> ratti</i>
空间在哪里?
日志
line 1 column 1 - Warning: missing <!DOCTYPE> declaration line 1 column 1 - Warning: plain text isn't allowed in <head> elements line 1 column 8 - Warning: <span> is probably intended as </span> line 1 column 5 - Warning: replacing unexpected span by </span> line 1 column 33 - Warning: discarding unexpected </span> line 1 column 40 - Warning: discarding unexpected </i> line 1 column 1 - Warning: inserting missing 'title' element line 1 column 8 - Warning: trimming empty <span> Info: Document content looks like HTML 4.01 Transitional 8 warnings, 0 errors were found! <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org"> <title></title> </head> <body> word<i>ratti</i> </body> </html>
答案 0 :(得分:1)
此问题似乎已在较新版本中得到解决。我使用的是2003年的版本。我只是updated tidy on my machine和2009年版本,输出如下所示。
content: word<i><span> <span>ratti</span></span></i>
command: tidy file.html
output: word <i><span><span>ratti</span></span></i>
所以它现在正在保留空间,但它不会删除span
标记,无论如何这看起来像是对问题的正确答案。