View Single Post
Old 12-11-2023, 12:11 AM   #195
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@DNSB,

When I ran the plugin with no options on this simplified code:

Code:
<p>This <span> </span>is a test for</p>
After plugin run, I had this result:

Code:
<p>This <span/>is a test for</p>
In the code, notice that <span> </span> has been converted from a double tag span entity to this <span/>, which is a useless and redundant single tag span entity that does nothing. But interestingly, the test EPUB still passed Epubcheck, even though that single tag span is redundant and useless code.

And as I've also described in a previous post -- it's probably my use of python's BeautifulSoup(BS) module that's causing the double span tag with blank space to convert to single span tag format with no blank space. And nowhere in my BeautifulSoup code am I deliberately trying to convert to single tag format.

So, unfortunately, I can't fix the above problem -- because it's a BeautifulSoup problem.

I tried another simple test to confirm my findings. I added a horizontal rule with a blank space to the EPUB like this:

Code:
<hr> </hr>
Then I ran my plugin and BeautifulSoup changed the above line to:

Code:
<hr/>
. . .to single tag format - just like the span tag with blank space.

And just to clarify that the above span problem seems to be normal BeautifulSoup
behaviour for any tag like <a>, <hr> or <span> that contains just a blank space.

And, like I've said, I can't fix that problem if the cause is inside python's BeautifulSoup module. So your only option appears to be to manually remove all of those useless single tag span entities in Sigil using search and replace.

Last edited by slowsmile; 12-11-2023 at 12:32 AM.
slowsmile is offline   Reply With Quote