Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self closing <i/> tags result in all subsequent paragraphs being italic #104

Open
dstaley opened this issue Jan 26, 2025 · 1 comment
Open

Comments

@dstaley
Copy link

dstaley commented Jan 26, 2025

When a paragraph contains a self closing italic tag <i/>, the resulting kepub has all subsequent paragraphs in italic. Based on my reading of the net/html fork used, I believe this is because <i> is not one of the specific tags allowed to be self closing.

Here is a sample from an EPUB purchased from Tor Books:

<p>Lopen ended up sprawled against a boulder, upside down, ribs screaming as they knit back together with Stormlight.<i/></p>
<p>“Radiant Lopen!” Kstled said, ducking in close. “Are you all right?”</p>
<p>“Feel like a piece of snot,” Lopen said, groaning, “following a sneeze.” He peeled himself off the rock and flopped down next to Kstled. “My spear can’t get through that thing’s carapace.”</p>

And this is the resulting kepub from the same snippet:

<p><span class="koboSpan" id="kobo.11.1">Lopen ended up sprawled against a boulder, upside down, ribs screaming as they knit back together with Stormlight.</span><i></i></p><i>
<p><span class="koboSpan" id="kobo.12.1">“Radiant Lopen!” </span><span class="koboSpan" id="kobo.12.2">Kstled said, ducking in close. </span><span class="koboSpan" id="kobo.12.3">“Are you all right?”</span></p>
<p><span class="koboSpan" id="kobo.13.1">“Feel like a piece of snot,” Lopen said, groaning, “following a sneeze.” </span><span class="koboSpan" id="kobo.13.2">He peeled himself off the rock and flopped down next to Kstled. </span><span class="koboSpan" id="kobo.13.3">“My spear can’t get through that thing’s carapace.”</span></p>

The first paragraph contains an expanded empty <i></i> tag, but ends in an opening <i> tag, which results in the remainder of the chapter being rendered in italics.

@pgaskin pgaskin self-assigned this Jan 27, 2025
@pgaskin pgaskin added the bug label Jan 27, 2025
@pgaskin
Copy link
Owner

pgaskin commented Jan 27, 2025

I already have some code I'm using in other projects to deal with this. I'll fix it when I get around to updating kepubify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants