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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2010, 11:37 AM   #1
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Specify indent in css, not with &nbsp

I'm converting a book from odt to epub with Calibre. In odt the first line indent is handled by Open Office, and works well. When it is converted by Calibre, I see two things. There is a small first line indent, and in addition there is a variable number of &nbsp entries, which appear to range from 0 to 5, making for non-aligned initial letters.

Isn't it possible to code the first line indent in the css and skip the &nbsp code?
James_Wilde is offline   Reply With Quote
Old 09-13-2010, 11:49 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: 24,766
Karma: 4369667
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre does not insert nbsp if there's nbsp in the output then it was there in the input
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 09-13-2010, 11:58 AM   #3
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,563
Karma: 12369681
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by kovidgoyal View Post
Quote:
Originally Posted by James_Wilde View Post
Isn't it possible to code the first line indent in the css and skip the &nbsp code?
calibre does not insert nbsp if there's nbsp in the output then it was there in the input
You can verify this for yourself by putting a directory in the debug area of conversion and after the conversion is complete you can easily review the resultant html. This directory will show you the code at each point in the conversion process.
DoctorOhh is offline   Reply With Quote
Old 09-13-2010, 12:31 PM   #4
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by dwanthny View Post
You can verify this for yourself by putting a directory in the debug area of conversion and after the conversion is complete you can easily review the resultant html. This directory will show you the code at each point in the conversion process.
Thanks, Dwanthny, I forgot I always save the debug information now. It can be so helpful.
James_Wilde is offline   Reply With Quote
Old 09-13-2010, 12:48 PM   #5
WebDesignEbooks
Member
WebDesignEbooks began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2010
Location: Canada
Device: Sony
Quote:
Originally Posted by James_Wilde View Post
Isn't it possible to code the first line indent in the css and skip the &nbsp code?
If you want to keep the indents, yes there is. CSS text-indent Property
WebDesignEbooks is offline   Reply With Quote
Old 09-13-2010, 07:02 PM   #6
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by WebDesignEbooks View Post
If you want to keep the indents, yes there is. CSS text-indent Property
That's what I thought. I see that in the css paragraph definitions. BTW, how long is an em? Is it a constant or is it dependent upon the typeface?
James_Wilde is offline   Reply With Quote
Old 09-13-2010, 07:21 PM   #7
WebDesignEbooks
Member
WebDesignEbooks began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2010
Location: Canada
Device: Sony
Quote:
Originally Posted by James_Wilde View Post
how long is an em? Is it a constant or is it dependent upon the typeface?

Quote:
1em is equal to the current font size. 2em means 2 times the size of the current font. E.g., if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses
CSS Units - w3schools
WebDesignEbooks is offline   Reply With Quote
Old 09-13-2010, 09:48 PM   #8
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
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.

I don't believe odt files go through that code path during conversion, but if you take the html in the debug output, add that back as a new format, then re-convert with preprocess enabled in structure detection, you should be in good shape.

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.

Last edited by ldolse; 09-13-2010 at 09:50 PM.
ldolse is offline   Reply With Quote
Reply

Tags
&nbsp, first line, indent

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
txt to Epub - nbsp nbsp cybmole Calibre 1 09-17-2010 09:05 AM
Unwanted $nbsp; Nathanael Sigil 10 09-07-2010 03:52 PM
CSS wacky p indent post-chapter split? Hitch Sigil 0 06-17-2010 08:59 PM
Mobiperl   lost when converting to mobi Jellby Kindle Formats 19 08-26-2008 03:10 PM
CSS & regex for chapter titles hpstricker Calibre 3 07-17-2008 10:13 AM


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


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