MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Weird formatting issues - Sigil .epub in Calibre viewer (https://www.mobileread.com/forums/showthread.php?t=87107)

december 06-15-2010 09:35 PM

Weird formatting issues - Sigil .epub in Calibre viewer
 
1 Attachment(s)
All right, I've been beating my head against this for most of the day with no success, so I'm calling in the cavalry - maybe someone here can help! I'm not really sure whether this best classifies as a Sigil or a Calibre problem, but I'll try here first.

Here's my problem: I hand-created an .epub file in Sigil, nothing too fancy - just some chapters and a single stylesheet. Everything looks great in Sigil... but when I try to open the .epub in the Calibre viewer (and subsequently try to convert it to .mobi), it seems to be stripping off all my formatting from my "special" paragraph tags -- any italicized, center-aligned, etc. classes are all made plain and indented on the left, just like my normal paragraphs.

Changing these classes to h1, h2, etc. settings (in other words, replacing a <p class="title"> with an <h2 class="title"> designation) will make the font larger, but doesn't fix the 'stripping' problem (i.e., I just have large text that is still left-aligned and non-italicized).

I've attached the .epub file here in case anyone wants to see the original code. Thanks for any help you can provide!

charleski 06-16-2010 04:22 AM

1 Attachment(s)
You put the style code in the CDATA section, which means it gets ignored.

I fixed it for you and also fixed the text-indent problem and a filename issue, but you need to add another selector with text-indent: 0 and use it for the opening paragraphs. (I still use the old version of Sigil so the organisation of the files will be a bit different).

december 06-16-2010 12:47 PM

So that's what 'CDATA' means! It kept auto-inserting itself into any copy/pasted style code so insistently that I just gave up and left it alone, assuming it was something Sigil found important for some reason. (Can you tell it's my first time working with .epub? :))

Thank you so much for the help! I will work on the borked selectors and hopefully get this thing working this time.

Valloric 06-16-2010 01:00 PM

Quote:

Originally Posted by december (Post 963000)
So that's what 'CDATA' means! It kept auto-inserting itself into any copy/pasted style code so insistently that I just gave up and left it alone, assuming it was something Sigil found important for some reason.

CSS code in style tags should be within CDATA sections, but regular HTML code should not be. You put your <link> tag within a CDATA section and thus told any conforming XML processor to ignore everything within it.

pietvo 06-17-2010 11:10 AM

The weird thing is, the CDATA is not visible in Code view.

Valloric 06-17-2010 12:35 PM

Quote:

Originally Posted by pietvo (Post 964606)
The weird thing is, the CDATA is not visible in Code view.

Tidy probably removed it on load, and for good reason since it contained HTML code.

pietvo 06-18-2010 01:00 AM

Quote:

Originally Posted by Valloric (Post 964710)
Tidy probably removed it on load, and for good reason since it contained HTML code.

But it will still be in the ePub file on disk.
The following code:
Code:

  <style type="text/css">
/*<![CDATA[*/
  <link rel="stylesheet" type="text/css" href="../Styles/StyleNovel.css"/>
  /*]]>*/
  </style>

according to the XML definition should be equivalent to:
Code:

  <style type="text/css">
/**/
  &lt;link rel="stylesheet" type="text/css" href="../Styles/StyleNovel.css"/&gt;
  /**/
  </style>

which is quite different from what Sigil shows and apparently interprets. Of course the code above is nonsense.

Valloric 06-18-2010 06:31 AM

You mean the CDATA is there before loading, is not there in Sigil, and then reappears when you save the book?

pietvo 06-18-2010 04:33 PM

Yes, that's exactly what happens.

Valloric 06-18-2010 05:04 PM

I'll have to take a better look at it then.


All times are GMT -4. The time now is 06:40 PM.

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