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, 06:33 AM   #1
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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, 199 views)
bhoyt is offline   Reply With Quote
Old 01-24-2014, 09: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: 43,796
Karma: 22666666
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 online now   Reply With Quote
Advert
Old 01-24-2014, 03:12 PM   #3
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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 03:45 PM.
bhoyt is offline   Reply With Quote
Old 01-24-2014, 04:11 PM   #4
JimmyR
ɴₐɴ
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.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
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, 184 views)
JimmyR is offline   Reply With Quote
Old 01-24-2014, 04:30 PM   #5
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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, 184 views)

Last edited by bhoyt; 01-24-2014 at 04:36 PM.
bhoyt is offline   Reply With Quote
Advert
Old 01-24-2014, 04:39 PM   #6
JimmyR
ɴₐɴ
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.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
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 04:41 PM.
JimmyR is offline   Reply With Quote
Old 01-24-2014, 04:42 PM   #7
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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, 04:52 PM   #8
JimmyR
ɴₐɴ
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.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
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 offline   Reply With Quote
Old 01-24-2014, 04:57 PM   #9
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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, 05:01 PM   #10
JimmyR
ɴₐɴ
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.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
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 offline   Reply With Quote
Old 01-24-2014, 05: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: 2,251
Karma: 3720310
Join Date: Jan 2009
Location: USA
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, 05:32 PM   #12
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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, 06:56 PM   #13
JimmyR
ɴₐɴ
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.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
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.
https://www.mobileread.com/forums/sho...26#post1108526
JimmyR is offline   Reply With Quote
Old 01-24-2014, 07:03 PM   #14
jackie_w
Grand Sorcerer
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: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
@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 offline   Reply With Quote
Old 01-24-2014, 07:12 PM   #15
bhoyt
Enthusiast
bhoyt began at the beginning.
 
bhoyt's Avatar
 
Posts: 39
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 04:20 PM
Reducing left-margin indent Siavahda ePub 1 02-10-2013 12:40 PM
Calibre Indent Issue When Removing Blank Lines (Converting From HTML to MOBI or EPUB) David Derrico Calibre 5 08-04-2010 12: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 01:47 AM
Small html/css bug twaits Calibre 5 01-12-2010 10:26 AM


All times are GMT -4. The time now is 09:01 AM.


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