Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-24-2014, 07:33 AM   #1
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
Bug converting html css text-indent and left-margin

Back in version 0.9.25 I converted by NIV Bible. It worked well.

Now I have revised the indentation of poetry and genealogical lists. But using calibre 1.21 the   are removed and negative text-indent used with left-margin is incorrect.

In the attached files (test.html, test.css) the indentation is correct in my browsers but not when I convert to azw3 for my kindle.

Note: line 11: <p class="poet04">&nbsp;&nbsp;<sup class="vn" id="v01010002">2</sup>The sons ...

It converts to: <p class="poet"><sup class="vn" id="v01010002">2</sup>The sons ...

The &nbsp; are removed which I am using for proper indentation. And the class="poet04" which has margin-left:4em; and text-indent:-4em; is changed to class="poet" with margin-left:4em; but text-indent:3% WRONG!!

Note: line 9: <p>&nbsp;&nbsp;<sup class="vn" id="v01010001">1</sup>This is ...

It converts to: <p class="calibre1"><sup class="vn" id="v01010001">1</sup>This is ...

Again the &nbsp; are removed and the <p> tag is replaced by <p class="calibre1"> with a text-indent:3% which is close to correct. OK.

Can the &nbsp; be left and the margin and text-indent settings be left so that my indentations will work correctly?

If not what kind of fix should I use?

Thanks, Kovid.
Your program is great!! Thanks muchly for all the work you have put into it.
Attached Files
File Type: zip test.zip (2.2 KB, 17 views)
bhoyt is offline   Reply With Quote
Old 01-24-2014, 10:42 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,338
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The nbsp are not removed they are converted to the unicode nbsp character, which renders exactly the same.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 01-24-2014, 04:12 PM   #3
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
Thanks, Kovid. But I gather that the unicode nbsp characters are then replaced by a text-indent which in the test.zip I have attached is wrong since it is not negative. See line 11 that I mentioned above for this.

I presume this is a bug.

Last edited by bhoyt; 01-24-2014 at 04:45 PM.
bhoyt is offline   Reply With Quote
Old 01-24-2014, 05:11 PM   #4
JimmyR
Ebook Enthusiast
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
Posts: 212
Karma: 839738
Join Date: Jun 2011
Device: Kindle Keyboard, Touch, PW
When I convert your test.zip to azw3, this is what I end up with:
Code:
<p class="poet">**<sup class="vn" id="v01010002">2</sup>The sons<sup class="fnr"><a class="calibre3" href="part0000.html#fn01010002a">1</a></sup> of Japheth:</p>

CSS:
.poet {
    display: block;
    text-align: left;
    text-indent: -4em;
    margin: 0 0 0 4em
    }
The asterisks are the unicode nbsps.

I'm not sure why you would end up with a text-indent of 3%.
Attached Files
File Type: azw3 test.azw3 (13.9 KB, 8 views)
JimmyR is online now   Reply With Quote
Old 01-24-2014, 05:30 PM   #5
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
That's very strange! I just re-added the test.zip to make sure and then converted to azw3 and I get this (note there are no nbsp characters):

<p class="poet"><sup class="vn" id="v01010002">2</sup>The sons<sup class="fnr"><a href="part0000.html#fn01010002a">1</a></sup> of Japheth:</p>

CSS:
.poet {
display: block;
text-align: left;
text-indent: 3%;
margin: 0 0 0 4em
}

Why the difference? I am running Win7 and using Calibre 1.21 64bit

Bruce
Attached Files
File Type: azw3 test - Unknown.azw3 (15.1 KB, 9 views)

Last edited by bhoyt; 01-24-2014 at 05:36 PM.
bhoyt is offline   Reply With Quote
Old 01-24-2014, 05:39 PM   #6
JimmyR
Ebook Enthusiast
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
Posts: 212
Karma: 839738
Join Date: Jun 2011
Device: Kindle Keyboard, Touch, PW
I'm running Win7 - Calibre 1.21 32bit. What input/output profiles are you using on Page Setup in the conversion dialogue? I don't think that would matter, however. I tried various combinations and ended up with the same results.

It is strange and I'm at a loss to explain it. You might try restoring defaults in the conversion options- though I don't see any settings that would cause your problem.

Edit: I used the default input and Kindle Paperwhite for output.

Last edited by JimmyR; 01-24-2014 at 05:41 PM.
JimmyR is online now   Reply With Quote
Old 01-24-2014, 05:42 PM   #7
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
Also strange is that a line down a bit with only one nbsp is rendered correctly:

<p class="poet3">*<sup class="vn" id="v01010013">13</sup>Mizraim was the father of</p>

CSS:
.poet3 {
display: block;
text-align: left;
text-indent: -4em;
margin: 0 0 0 4em
}
bhoyt is offline   Reply With Quote
Old 01-24-2014, 05:52 PM   #8
JimmyR
Ebook Enthusiast
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
Posts: 212
Karma: 839738
Join Date: Jun 2011
Device: Kindle Keyboard, Touch, PW
I got your results when I enabled "Smarten punctuation" in the Look & Feel options. Do you have that enabled? If so, disable it.
JimmyR is online now   Reply With Quote
Old 01-24-2014, 05:57 PM   #9
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
Ah, yes!!! Thank you very much. That solved the problem.
But I wonder what smarten punctuation is doing with text-indent?
bhoyt is offline   Reply With Quote
Old 01-24-2014, 06:01 PM   #10
JimmyR
Ebook Enthusiast
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
Posts: 212
Karma: 839738
Join Date: Jun 2011
Device: Kindle Keyboard, Touch, PW
Quote:
Originally Posted by bhoyt View Post
Ah, yes!!! Thank you very much. That solved the problem.
Great! Glad that sorted it.

Quote:
But I wonder what smarten punctuation is doing with text-indent?
I really don't know enough about how it works to proffer an explanation.

Again, glad it's working for you now.
JimmyR is online now   Reply With Quote
Old 01-24-2014, 06:22 PM   #11
susan_cassidy
Wizard
susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.
 
Posts: 1,935
Karma: 1704270
Join Date: Jan 2009
Device: Kindle, iPad (not used much for reading)
text-indent doesn't have anything to do with &nbsp; You shouldn't be using non-breaking spaces for indentation anyway, just the text-indent specification.
susan_cassidy is offline   Reply With Quote
Old 01-24-2014, 06:32 PM   #12
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
Yes, I know that I should use text-indent for indent purposes but for this purpose it seems that nbsp is the better option. Why? because some verses have one digit numbers (1-9) and others have two digit numbers (10-99) and a few have three digit numbers (100+). That is a content matter not a CSS formatting matter.

I could do the indentation by requiring all numbers to be three digits (001-100+) but leading zeros doesn't look good.

The text-indent option requires me to make a different class for three different sizes of verse numbers. That seems like forcing content into the CSS formatting.

Any advice?
bhoyt is offline   Reply With Quote
Old 01-24-2014, 07:56 PM   #13
JimmyR
Ebook Enthusiast
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
Posts: 212
Karma: 839738
Join Date: Jun 2011
Device: Kindle Keyboard, Touch, PW
Apparently, multiple nbsps are removed and a 3% indent is added:
Quote:
Originally Posted by ldolse on 09-13-2010 View Post
Some logic just got hooked into the preprocess option to take care of multiple nbsp's being used as indents, converting them to css styles. The code was just checked in, so it will be in the next release.

...

Right now it just takes any number(2 or more) of nbsps and normalizes them to 3% indent. I've been debating changing the indent based on the actual number of nbsps, but a lot of books I've seen use entirely too many anyway.
http://www.mobileread.com/forums/sho...26#post1108526
JimmyR is online now   Reply With Quote
Old 01-24-2014, 08:03 PM   #14
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,882
Karma: 4200035
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
@bhoyt,
For this particular book, you should check the settings you had on the Convert - HeuristicProcessing page. If you have checked both of

- the first box (Enable heuristics) and
- the last box (Replace entity indents with CSS indents),

you might find this is where the problem lies
jackie_w is online now   Reply With Quote
Old 01-24-2014, 08:12 PM   #15
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: Oamaru, New Zealand
Device: KT, Android Tablet and Phone
jackie_w, I have heuristics disabled since I make format my own html files directly.


Jimmy-Jim, thanks for that link. It explains why 2 nbsp were converted to 3% indent, whereas 1 was not.
bhoyt is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Margin/word flow issues when converting from RAR(CSS?) to epub... camobmus Conversion 0 06-20-2013 05:20 PM
Reducing left-margin indent Siavahda ePub 1 02-10-2013 01:40 PM
Calibre Indent Issue When Removing Blank Lines (Converting From HTML to MOBI or EPUB) David Derrico Calibre 5 08-04-2010 01:13 AM
HTML to .MOBI: large l.h. margin; text cuts off on the rt. Ideas how to fix? thorn Calibre 1 02-21-2010 02:47 AM
Small html/css bug twaits Calibre 5 01-12-2010 11:26 AM


All times are GMT -4. The time now is 11:01 PM.


MobileRead.com is a privately owned, operated and funded community.