Using the automatic fix in the calibre editor, adds an open and close i tag inside each paragraph until the end of the document. I'd expect a conversion to do the same thing. Sigil also does the same thing if you let if fix the error.
To my mind, both of those would over do it. I would have thought to put the closing tag just before next closing tag that keeps the nesting correct. For your test cases, that would mean at the end of that paragraph. But, the way the editor does it is correct if there is a matching close paragraph further down the document. I have had a few cases like this.
I don't think this is something that an automatic solution good for. You can use the tools to find the errors. Then you need to look at the text to decide where the closing tag goes. If it is at the beginning of the paragraph, it probably goes at the end. But, if it is immediately after an open quote, then it probably needs to go somewhere before the closing quote.
|