MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   sigil "condensation" of nested <div>'s (https://www.mobileread.com/forums/showthread.php?t=172798)

bobb40 03-20-2012 03:37 PM

sigil "condensation" of nested <div>'s
 
I imported a large valid ebook xhtml file to Sigil (version 0.5.3), saved to epub, and found that all nested <div>'s had been "condensed"; e.g.,

xhtml file content...
<div class="outer">
<div class="middle">
<div class="inner">
<img src="example.jpg" alt="example">
</div>
</div>
</div>

appeared in the epub as:
<div class="outer middle inner">
<img src="example.jpg" alt="example">
</div>

I googled unsuccessfully for explanation, so tried the notation on good example code and found it didn't work.

Is there an explanation or workaround for this?

Perkin 03-20-2012 04:03 PM

Quote:

Originally Posted by bobb40 (Post 2011408)
xhtml file content...
<div class="outer"><!-- nothing -->
<div class="middle"><!-- nothing -->
<div class="inner">
<img src="example.jpg" alt="example"/>
</div>
</div>
</div>

Change to include the two comments in red and close the img tag properly.

Will that do?

mmat1 03-20-2012 04:14 PM

Quote:

Originally Posted by bobb40 (Post 2011408)
Is there an explanation or workaround for this?

To answer your question for a workaround: adding a "&nbsp;" after the first two divs would prevent this behavior. But the blank may not be welcome ...

The explenation: i guess there should be not difference in behavior of the reader at all.

What makes it for you different ?

-------------------
Perkins workaround is much better than mine...

JSWolf 03-20-2012 09:00 PM

Run Sigil, turn off Tidy and then load your XML and see if it still changes your divs.

bobb40 03-21-2012 06:15 AM

Quote:

Originally Posted by JSWolf (Post 2011773)
Run Sigil, turn off Tidy and then load your XML and see if it still changes your divs.

That made all the difference, thanks!! Now I'll always run with tidy off.

The workarounds might've worked, but they would've been a lot of trouble so I'm glad they're not required.

Thanks, all!

JSWolf 03-21-2012 08:42 PM

So it seems Tidy is tidying more then just the full paragraph styles. Bah!


All times are GMT -4. The time now is 10:30 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.