File.html
word<i><span> <span>ratti</span></span></i>
Command
$ tidy File.html
Output
word<i>ratti</i>
Desired output
word<i> ratti</i>
Where's the space?
Log
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>
This issue seems to have been solved in newer versions. I was using the version from 2003. I just updated tidy on my machine with 2009'th version and with that the output is like below.
content: word<i><span> <span>ratti</span></span></i>
command: tidy file.html
output: word <i><span><span>ratti</span></span></i>
So it is preserving space now, however it does not delete the span
tag, anyway this looks like a proper answer to the question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With