Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 08-09-2009, 11:08 AM   #1
acj412
Junior Member
acj412 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Apr 2009
Device: Sony Reader 505
Create proper paragraph breaks in ereader2html

When using ereader2html.py to read books on my Sony, I noticed that there are no spaces betwen paragraphs, nor are there any indentations. Looking closer at the output html, I noticed that the original paragraph indents are present (as spaces), and that paragraphs are separated by a line break only (<br>). This works for ereader files, but in html, the spaces at the beginning of the line get ignored. This generates a file that is much harder to read, as you have neither an indentation nor an extra space to separate paragraphs.

As a workaround, I replaced the line in the ereader2html source code

s = s.replace('\n', '<br>\n')

with

s = s.replace('\n', '<p>\n').

Now individual paragraphs are separated by spaces. Also, you can now use calibre's "Remove spacing between paragraphs." option if you want to remove spaces between paragraphs and use indents instead.

Depending on how the publisher uses the \n tag in the original ereader code, you might introduce other formatting quirks. But, in most cases, I think this change creates a more readable text.
acj412 is offline   Reply With Quote
Old 08-10-2009, 03:54 PM   #2
texasnightowl
Guru
texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.texasnightowl ought to be getting tired of karma fortunes by now.
 
Posts: 699
Karma: 1001556
Join Date: Jul 2008
Location: Texas
Device: Oasis 3, K4B(NT), K3/KK
ooh! thanks. I'll give this a try. I was converting some files yesterday with ereader2html and noticed paragraph issues. The only one I went in and corrected though was one that had right justification instead of full...everything was justified to the right which looked nuts!
texasnightowl is offline   Reply With Quote
Advert
Old 08-10-2009, 11:02 PM   #3
FizzyWater
You kids get off my lawn!
FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.FizzyWater ought to be getting tired of karma fortunes by now.
 
FizzyWater's Avatar
 
Posts: 4,220
Karma: 73492664
Join Date: Aug 2007
Location: Columbus, Ohio
Device: Oasis 2 and Libra H2O and half a dozen older models I can't let go of
I only get the problem with no spacing or indents on certain ereader files. Do you happen to know if this work around will cause too much spacing if the files would have converted alright with the old script?
FizzyWater is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to EPUB - spurious paragraph breaks RichieTheK Calibre 2 09-08-2010 11:27 AM
Paragraph breaks thedevilsjester Calibre 2 09-07-2010 12:26 PM
scanned PDF has weird paragraph breaks. Possible to fix lunixer PDF 0 08-30-2010 10:47 PM
Converting from LRF: Paragraph & Line Breaks wudaben LRF 0 07-14-2010 11:32 PM
Odd line/paragraph breaks in epub and FB2? PKFFW Calibre 4 10-01-2009 07:49 AM


All times are GMT -4. The time now is 12:20 AM.


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