View Single Post
Old 03-08-2012, 12:59 PM   #1
wcooley
Junior Member
wcooley began at the beginning.
 
wcooley's Avatar
 
Posts: 8
Karma: 10
Join Date: Dec 2010
Device: Graphite Kindle DX
extra_css not working with embedded content?

Calibre 0.8.41, targeting a graphite Kindle DX (but mostly working with ebook-viewer).

I'm working on a recipe to pull the Atom feeds of commits from GitHub, which should be pretty simple:

Code:
class GitHubCommits(BasicNewsRecipe):
    title          = u'GitHub Commits'
    oldest_article = 7
    max_articles_per_feed = 100
    auto_cleanup = True
    use_embedded_content = True
    extra_css = 'pre,code,samp,kbd,tt { font-size: 80% }\nblockquote {margin-left:0 }\n* { color: black }'

    feeds          = [(u'Puppet', u'https://github.com/puppetlabs/puppet/commits/master.atom')]
The only real customization is the ''extra_css'' bit, which I need because my Kindle DX seems to use fixed-width fonts that are the same point size as the variable-width, which makes the former end up looking too big (and not fitting as well on line).

One of the first things I tried was to increase the contrast, to ensure that I am really not seeing the effect I expect, so I tried the font-size as both 50% and 200%. The results in E-book Viewer were surprising--instead of the fixed-width font decreasing or increasing in size, it stays the same but the font of the text in the feed's <title> is scaled up or down, respectively.

Noticing that the feed has style added to parts of the <pre>, I have tried adding the following too:
Code:
    remove_attributes = ['style', 'font']
I was originally going to ask if extra_css worked or was applicable for embedded content at all, but I have another recipe that is essentially identical where the CSS works as expected:

Code:
class AdvancedUserRecipe1321465899(BasicNewsRecipe):
    title          = u'Puppet'
    oldest_article = 14
    max_articles_per_feed = 100
    auto_cleanup = True
    extra_css = u'pre,code,samp,kbd,tt { font-size: 50% }\nblockquote {margin-left:0 }\n* { color: black !important }'
    use_embedded_content = True

    feeds          = [(u'Planet Puppet', u'http://feeds.feedburner.com/planetpuppet?format=xml')]
The only difference in the feeds that I see that might make a difference is that GitHub encodes the less-than at the start of tags but not the greater-than, whereas the Planet feed encodes them both.

Any hints about where I'm going wrong?
wcooley is offline   Reply With Quote