Epub output errors in new 3.4. release

I’m getting the following error when I open the epub created by the new 3.4 release in Sigil:

Here is the offending HTML in body30.xhtml:

<p class="ps15">Perhaps the decision to delegate the search for serialization deals was due to the rejection by the American Nature Association in the previous letter. Subsequent correspondence does reveal that there was one successful serialization deal.<a href="footnotes.xhtml#fn48" class="fn-marker" id="fn48">48</a></div></p>

The error Sigil reports is “Opening and ending tag mismatch: p line 26 and div”. There does indeed seem to be a stranded div end tag.

Looking at the other offending file, I find in both cases the problem is the last paragraph in the file and both end with a footnote–perhaps a clue. Here is the end chunk of the other file:

<p class="ps11">Major Wood had placed Grey Owl at Lake Ajawaan in 1931 and had Beaver Lodge built to meet his specifications. Wood later defended him when officials in Ottawa raised doubts about the value of retaining his services. He was with Grey Owl when he died on 13 April 1938, reporting &quot;At 8.25 in the morning, he died very quietly, and pictures taken show that the congestion in his lungs [pneumonia] was very slight, which all goes to prove that he had absolutely no resistance whatever.&quot; After Grey Owl’s death, Wood was one of the diehards that refused to believe the allegations against him for some time. After finally giving in, Wood wrote “I care not whether he was an Englishman, Irishman, Scotsman or Negro. He was a great man with a great mind, and with great objectives which he ever kept before him.”<a href="footnotes.xhtml#fn82" class="fn-marker" id="fn82">82</a></div></p>

</body>
</html>

Can you spot any other ingredients in the mix that might be involved? I’ve run a quick check of both footnote types (inline/linked), positioned as the final text in a section, and do not run into any HTML containment errors like you demonstrate here.

This is my test project, maybe give that a look and see what I’d need to do to modify it to reproduce the bug, or send a snippet copy of your own project (you can DM me that to keep it out of the public forum, by clicking on my avatar and then the Message button). All I would need is one chunk in the binder that shows it happening, so a stripped down Save As copy of the project is fine, and would keep the project and compile settings intact.

final_footnote_bug.zip (28.5 KB)

This almost certainly is a side-effect of a fix we made to footnotes in 3.4, that resolved cases where empty lines in footnotes would end up printing those lines into the source text where the footnote came from, breaking paragraphs in half and so forth. So code that is stripping newlines might be a factor here if too much is being stripped in some scenarios.


Oh wait, I did just notice there is a problem with the final paragraph. It’s not a validity level problem according to ePubCheck and Sigil, but it isn’t good form. Basically the last paragraph is not a paragraph (<p>...</p>). So we should fix that, but it would be nice to have your condition in on the ticket as well, as they are undoubtedly related.