![]() |
#376 |
Enthusiast
![]() ![]() 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 |
![]() |
![]() |
![]() |
#377 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
send me the file.
|
![]() |
![]() |
Advert | |
|
![]() |
#378 |
Enthusiast
![]() ![]() 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.
|
![]() |
![]() |
![]() |
#379 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
its in a <pre> tag.
|
![]() |
![]() |
![]() |
#380 |
Enthusiast
![]() ![]() 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. |
![]() |
![]() |
Advert | |
|
![]() |
#381 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#382 |
Member
![]() 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> |
![]() |
![]() |
![]() |
#383 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#384 |
Member
![]() 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 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? |
![]() |
![]() |
![]() |
#385 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#386 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#387 |
Member
![]() 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-space
![]() Just an idea. Good going with the addition of hanging indent! ![]() |
![]() |
![]() |
![]() |
#388 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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> |
![]() |
![]() |
![]() |
#389 |
Member
![]() 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> HTML creates a tree of its elements (Which I'm sure you're aware of). Code:
<p> "one" <span> " two" </span> 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. |
![]() |
![]() |
![]() |
#390 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
Tags |
html2lrf, libprs500 |
|
![]() |
||||
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 |