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 05-28-2009, 09:05 AM   #1
sideburnt
Connoisseur
sideburnt began at the beginning.
 
Posts: 83
Karma: 46
Join Date: May 2009
Device: Sony prs-505
help with Claibre CSS override

view override CSS output

I have a bunch of LIT files that I am wanting to use on my PRS-505, on the whole around half of the files convert acceptibly and I am happy with the output, but the rest of them are all over the place, with linebreaks half way along the line

e.g.
Hello this is a test line and
this is the rest of the line.
Anyway this is a load of rubbish and I hope
this can be fixed.

and ropey paragraph layouts.

Now, I understand I can override the default layout via CSS which I am capable in, and I have used the p { text-indent: 0pt} command to test this, and it works well.

But on the whole I have no idea how my CSS override will effect the final outcome, it would be great to preview CSS changes on the fly. Is this possible? because I could fix the markup visually for each of my LIT files before I take the Epub conversion plunge.

Doing this by trial and error just seems mental for each file, since my source LIT books are layed out in different ways and need different customisation to make them readable as a epub ebook.

help, advice welcome. Thanks in advance
sideburnt is offline   Reply With Quote
Old 05-28-2009, 09:32 AM   #2
gwynevans
Wizzard
gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.
 
gwynevans's Avatar
 
Posts: 1,402
Karma: 2000000
Join Date: Nov 2007
Location: UK
Device: iPad 2, iPhone 6s, Kindle Voyage & Kindle PaperWhite
Convert the LIT to HTML then use a web development tool to preview - something like Firefox's Web Development plugin's "Edit CSS" option, or "Topstyle Pro", to name two...
gwynevans is offline   Reply With Quote
Advert
Old 05-28-2009, 10:31 AM   #3
sideburnt
Connoisseur
sideburnt began at the beginning.
 
Posts: 83
Karma: 46
Join Date: May 2009
Device: Sony prs-505
how do I do that?, I've looked int he Calibre directory and there doesn't seem to be a lit2html.exe or in fact anything 2 html. Only html2xxx.exe
sideburnt is offline   Reply With Quote
Old 05-28-2009, 10:47 AM   #4
WayneD
Enthusiast
WayneD began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Sep 2007
Device: Android phone + PRS-505
What you want is lit2oeb. The Open EBook format is based on HTML, and a simple command of "lit2oeb -o newdir Book.lit" will create a "newdir" and put the HTML in it.

You may discover that the line-break issue is not a CSS issue, but the presence of BR tags. If so, you'll need to edit them out, since a CSS override won't be able to deal with them.
WayneD is offline   Reply With Quote
Old 05-28-2009, 11:13 AM   #5
sideburnt
Connoisseur
sideburnt began at the beginning.
 
Posts: 83
Karma: 46
Join Date: May 2009
Device: Sony prs-505
I think you're right

I used ABC Amber Lit to convert to HTML and the book is formatted thus:

<p><span class=rvts6><br></span></p>
<p><span class=rvts6>In the world of Deathlands</span></p>
<p><span class=rvts6><br></span></p>
<p><span class=rvts6> There were, of course, survivors…</span></p>
<p><span class=rvts6><br></span></p>


However...I also converted another of my LIT books which converted well to epub via calibre, to html, and the page was formatted the same way, same CSS, same tags. Odd, can this be explained? (I checked some more of my LIT files and they all follow this tag format?!?)

In my experience a p tag is a paragraph tag, and I would expect to see more text inbetween these tags than a line, also p tags create space before and after themselves.

And soooo, on the face of things, I need to strip most of the <p> tags out, and delete the <br> tags. Is that right?

I'm so confused, I cant get my head around what the difference is between all of my LIT files that stops some from being converted correctly.
sideburnt is offline   Reply With Quote
Advert
Old 05-28-2009, 11:30 AM   #6
sideburnt
Connoisseur
sideburnt began at the beginning.
 
Posts: 83
Karma: 46
Join Date: May 2009
Device: Sony prs-505
eeeeer?

I used the lit2eob converter and got a different output, paragraph structure is liek this:

<p class="MsoPlainText">There were, of course, survivors.</p>
<p class="MsoPlainText">The world was not destroyed—just a way of life. The global population was cut </p>
<p class="MsoPlainText">down to perhaps one-fifth of what it had been. The ecosystems were utterly </p>
<p class="MsoPlainText">disrupted. The climate was transformed.</p>

which kind of shows AGAIN each line wrapped in p tags, but this time no <br>

how in the sweet bejeezus am I going to fix this little horror story, convert to txt then epub?
sideburnt is offline   Reply With Quote
Old 05-28-2009, 04:09 PM   #7
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
My guess (and it is just that) would be either of two things are the culprit:
  • The metadata is different between the sample files you mentioned. Perhaps slightly different encoding or something else that is just slightly off. If either sample book comes with CSS, the issue may be there instead. (Although I know you said you checked this.)
  • The original source document at the publisher's end was handled differently. The publisher(s) used different software programs (or versions) to generate their output and the results, as you're finding, are not optimal.
You may need to use a text editor with strong regular expression (regex) support in it's search & replace function. Some things can be automated and others will require oversight and your best judgment. On Windows, Notepad++ (free, available from sourceforge) or RegexBuddy (commercial software) can be used if you don't already have a regex tool. A word of warning, regex logic is quite convoluted if you need more than a simple search & replace.
Sabardeyn is offline   Reply With Quote
Old 05-28-2009, 08:25 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
Calibre creates a million css tags with lit files in the current version. Of course that makes trying reformat the file by modifying the stylesheet nearly impossible. .6 css creation has been completely re-worked to resolve this, but you'll need to wait a few weeks until the beta. It looks like lit2oeb is creating better output than Calibre today, so that's a better starting point. You want to stay away from amber lit converter.

Regarding line breaks in all the wrong places, that's because many lit files are pirated, and they're straight OCRs - the original scanner just left all the lit file line breaks where they were in the original printed book. There is a new feature in .6 that will allow optional post-processing during conversion to resolve issues like this - the framework is there, but lit files don't have the regex replacements in place yet. .6 is still several weeks away so it will probably be in by then.

See this bug for info on the new function in case you're interested in contributing:
http://calibre.kovidgoyal.net/ticket/2359
ldolse 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
Embedding Chinese font using CSS override? kome17 Calibre 0 09-18-2009 12:57 AM
css override code for margins? Amalthia Calibre 15 08-11-2009 07:20 PM
IMG css override not working anymore? Amalthia Calibre 10 08-03-2009 01:12 AM
centering images with css override? Amalthia Calibre 2 03-30-2009 01:53 PM
css override code for <h2> and <h1> tags Amalthia Calibre 2 03-29-2009 06:51 PM


All times are GMT -4. The time now is 07:47 PM.


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