Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
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
Old 03-08-2012, 10:20 PM   #2
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,311
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It definitely applies for embedded content as well, in fact it is applied in the same function as the navbar (see _postprocess_html() in feeds/news.py).
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Server url prefix not working Caleb666 Calibre 3 09-04-2011 11:43 AM
Help with extra_css DTM Recipes 2 02-16-2011 08:55 PM
Classic Check for new B&N content not working graddy Barnes & Noble NOOK 1 07-18-2010 09:40 PM
extra_css - need remedial help BrianG Calibre 3 01-21-2010 01:52 PM
PRS-500 Embedded fonts in LRF WORKING igorsk Sony Reader Dev Corner 21 03-23-2007 05:59 AM


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


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