calibre-devs team mailing list archive
-
calibre-devs team
-
Mailing list archive
-
Message #00088
Re: CSS normalization
On Monday 26 January 2009 22:31:31 Marshall T. Vandegrift wrote:
> On Mon, Jan 26, 2009 at 8:54 AM, Marshall T. Vandegrift
>
> <llasram@xxxxxxxxx> wrote:
> > Later today or this evenindI'll put together a few 'timeit' tests for
> > comparison with the current approach.
>
> Ah, the "evenindI'll," such a lovely time of day...
The beginning of the end of the day ;)
>
> Running just the any2epub CSS-extraction and font-rationalization
> ended up looking kind of bothersome... I ultimately just stuck some
> time.time() arithmetic around part of calibre.ebooks.epub.from_html
> and around a similar part of my own EPUB-generation pipeline (markup
> fixing, CSS flattening, and font normalization, the latter two being
> done as a single transform). The results themselves where pretty
> variable based on the input, and I'm not sure how to present anything
> useful without having some sort of "standard corpus" we could
> consistently make measurements against. On my machine, with most of
> the sources I ran against, full flattening was a few seconds slower
> (10 vs 8, 10 vs 12, and in one case 8 vs 4) on most inputs. But in the
> pathological case of a @style attribute on almost ever element, it was
> actually quite a bit faster (15 seconds vs. 30).
>
> That said, I think it's enough to validate that the basic approach is
> fast enough. And I think I can probably speed up Stylizer some more
> if I give it some more love.
>
Yeah I agree. The only remaining drawback I can think of is that it will mess
up class based javascript selectors. I know EPUB isn't supposed to support
javascript, but I believe that will change. However, if I understand the
algorithm correctly, that will only happen for tags that have style
attributes, so it shouldn't be too big a deal.
Kovid.
> -Marshall
>
> _______________________________________________
> Mailing list: https://launchpad.net/~calibre-devs
> Post to : calibre-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~calibre-devs
> More help : https://help.launchpad.net/ListHelp
>
> !DSPAM:3,497eaa4e75721577944289!
--
_____________________________________
Kovid Goyal MC 452-48
California Institute of Technology
1200 E California Blvd
Pasadena, CA 91125
cell : +01 626 390 8699
office: +01 626 395 6595 (449 Lauritsen)
email : kovid@xxxxxxxxxxxxxxxxxx
web : http://www.kovidgoyal.net
_____________________________________
Follow ups
References