Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-17-2007, 12:19 AM   #376
irishjew
Enthusiast
irishjew doesn't litteririshjew doesn't litter
 
Posts: 33
Karma: 108
Join Date: Jul 2007
Device: Sony Reader
Here's what I get. Looks pretty straightforward.

C:\Program Files\libprs500>html2lrf --verbose "C:\Program Files\libprs500\a.html"
[INFO] convert_from.py:391: Processing a.html
Parsing HTML...
[INFO] convert_from.py:405: Converting to BBeB...
[INFO] convert_from.py:1374: Output written to C:\Program Files\libprs500\a.lrf
irishjew is offline   Reply With Quote
Old 08-17-2007, 12:25 AM   #377
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
send me the file.
kovidgoyal is offline   Reply With Quote
Advert
Old 08-17-2007, 12:48 AM   #378
irishjew
Enthusiast
irishjew doesn't litteririshjew doesn't litter
 
Posts: 33
Karma: 108
Join Date: Jul 2007
Device: Sony Reader
Well, in the interest of not violating copyright laws, I'm attaching a test html file that I have the same problem with. If you open the html file, you'll see the link there working just fine, but the link doesn't appear in the lrf file.
Attached Files
File Type: zip test.zip (1.5 KB, 260 views)
irishjew is offline   Reply With Quote
Old 08-17-2007, 12:57 AM   #379
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
its in a <pre> tag.
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 01:09 AM   #380
irishjew
Enthusiast
irishjew doesn't litteririshjew doesn't litter
 
Posts: 33
Karma: 108
Join Date: Jul 2007
Device: Sony Reader
What do you mean? Sorry, I'm a noob.

I appreciate all this, by the way.
irishjew is offline   Reply With Quote
Advert
Old 08-17-2007, 01:21 AM   #381
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
the <a href> tag is inside a <pre> tag. Delete the <pre> tag and you'll be fine.
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 02:11 AM   #382
Excalibur
Member
Excalibur began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Aug 2007
Device: Sony eReader 500
That's an incorrect way of thinking about it, however. The <pre> tag is meant to hold other things within it like a DIV tag. Now, if you've supported the CSS property "white-space" that allows for text to be preformatted, then that's cool: white-space: pre;

<span><div><pre><p> and a few other tags are meant to hold links and other things within them.

If you support padding and text-indent, you might be able to try this:
Code:
<html>
<head>
<style>
p
{
	text-indent:-30px;
	padding-left:30px;
}
</style>
</head>
<body>
<p>Curabitur gravida imperdiet nunc. Vestibulum elementum, velit id porttitor viverra, mi dolor suscipit eros, id consequat justo magna a ante. Maecenas varius eleifend nunc. Cras sed tortor. Phasellus dignissim, erat sit amet ullamcorper vehicula, lorem mi faucibus sapien, eget imperdiet ligula odio nec est. Vivamus venenatis, velit in interdum blandit, ligula mi pulvinar leo, at mollis purus magna fermentum mauris. Phasellus et purus. Suspendisse potenti. Aenean egestas consectetuer enim. Morbi elit justo, scelerisque lobortis, ornare ac, tincidunt eget, orci. Mauris faucibus ornare sem. Praesent nisi arcu, malesuada non, nonummy sit amet, sollicitudin ac, elit. Mauris nec libero id lectus porta tincidunt. Morbi purus est, gravida eget, cursus ut, ultricies quis, sapien.</p>
</body>
</html>
Which produces a very nice hanging indent (of 30px anyway).
Excalibur is offline   Reply With Quote
Old 08-17-2007, 02:24 AM   #383
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah it's only <pre> that doesn't support links and that's because of a design decision I made when first writing html2lrf. Not supporting white-space made the code considerably simpler. In most html files it's more important to get the whitespace right than to support links in a <pre>.

As for the hanging indent, unfortunately SONY's LRF renderer doesn't support negative indents, AFAICT it treats them as zero.

EDIT: I was wrong, LRF can actually do hanging indents.

Last edited by kovidgoyal; 08-17-2007 at 02:29 AM.
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 02:36 AM   #384
Excalibur
Member
Excalibur began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Aug 2007
Device: Sony eReader 500
white space in html is ignored UNLESS you use <pre> which supports links. Supporting links with or without whitespace shouldn't be any different. Now, if that white space is designated as non-wrapping whitespace such as when you use the &nbsp; entity, that *might* be an issue, though the reader should automagically wrap it using it's own algorithms.

What's the difference between keeping track of the white space and not with your algorithms?
Excalibur is offline   Reply With Quote
Old 08-17-2007, 02:52 AM   #385
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
the problem is that in ordinary html multiple consecutive whitespace elements are collapsed into a single white space elemnt, while this is not true in LRF. So I have little checks that do this manually at multiple points in the code. I suppose I could hunt down every instance and wrap it in a if..else but that's a pain, and would require extensive debugging to make sure it doesn't break other behavior.
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 03:37 AM   #386
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Released v0.3.97 with support for the padding CCS attribute. This makes LaughingVulcan's hanging indents possible. See the new demo in the first post.

It'll reach the servers in ~30min.
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 08:29 AM   #387
Excalibur
Member
Excalibur began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Aug 2007
Device: Sony eReader 500
Can you use regular expressions in Python? That would eliminate the need for hunting down all the whitespace or wrapping an if-then around stuff. You'd just have to check to see if you were in a preformatted space such as with the white-spacere css declaration or the <pre> tag. If you were, you ignored the collapsing of white space. If not, just change white space within tags to one (div, p, etc -- the block elements) using a regular expression search & replace...

Just an idea.

Good going with the addition of hanging indent!
Excalibur is offline   Reply With Quote
Old 08-17-2007, 09:18 AM   #388
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It isn't that simple, what about the situation
Code:
<p>one <span> two</span>
kovidgoyal is offline   Reply With Quote
Old 08-17-2007, 09:45 AM   #389
Excalibur
Member
Excalibur began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Aug 2007
Device: Sony eReader 500
What about the situation? That would produce two spaces, that's how it renders in Firefox and in IE. Though if you had:

Code:
<p>one <span>  two</span>
which is 2 spaces between the <span> and two, it would reduce to 1 space.

HTML creates a tree of its elements (Which I'm sure you're aware of).
Code:
<p>
     "one"
     <span>
          " two"
     </span>
Since almost all browsers reduce extra whitespace down to 1 within any given tag, except those that are designated as white-space:pre or within <pre> tags, then it would be safe for you to eliminate all extra whitespace that exists within individual tags. Though, if that whitespace happens to already be 1 space in size then there's no reason to eliminate it.

That's how the browsers do it. If you wish to faithfully reproduce the same look as in the browsers, then do what they do. Instances where you want a single space between one and two above are going to drive you nuts. And I'd say, unless there is style information tied to a tag that you ignore the tag.

Since, in this case, unless there is a specific style attributed to the <span> tag, I'd simply ignore it since it's not doing anything.

Last edited by Excalibur; 08-17-2007 at 10:17 AM.
Excalibur is offline   Reply With Quote
Old 08-17-2007, 10:10 AM   #390
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No that renders with one space. And obviously assume there is some style information associated with the tag, since that's the case I have to worry about.

Last edited by kovidgoyal; 08-17-2007 at 10:12 AM.
kovidgoyal is offline   Reply With Quote
Reply

Tags
html2lrf, libprs500


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change font of header for LRF Output on PRS 505 duckbill Calibre 3 05-15-2010 11:07 AM
Pissed off with LRF formatting: LRF/LRS clean tool? grimborg LRF 8 02-15-2010 01:14 PM
Fonts for LRF output krischik Calibre 1 10-03-2009 05:01 AM
CBZ > LRF (LRF>HTML/MOBI????) sideburnt Calibre 4 09-15-2009 06:44 AM
libprs500 Issues Converting .LIT to .LRF - .LRF crashes everything vasbinde Calibre 6 02-14-2008 12:16 PM


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


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