I have some HTML documents that I need to batch fix. The main problems in the file are:
- Out of order tags (
<p><i>like this</p></i>
) - Unclosed tags (
<p>like this
)
I know the output won't be perfect, but I need to repair these simple problems quickly for further processing.
Is there a tool for this? I want a command-line tool that runs on Mac OS X or Linux. If there's nothing available, I'll end up writing my own, but I'd prefer something that's already built for the task, if it exists.
To clarify: This isn't a software recommendation question - I'm pretty sure there's no single piece of software that will do this, I'm looking more for bits and pieces to put together, like sed/awk/Python/etc. that can accomplish it. The two primary problems are the out of order and unclosed tags mentioned above. If I can solve those, the remaining problems are much easier to solve (encoding, etc.)
<input>
which don't close? Or the difference between<p>
and<p class="foo" style="color:blue">
? Or<p>
and< p>
?