View Single Post
Old 09-22-2010, 02:02 PM   #2814
krunk
Member
krunk began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Feb 2010
Location: Los Angeles, CA
Device: Kindle 3
@Starson17

I've modified your recipe, made a few blog additions, etc. and created a daily blog roll recipe.

Only problem is, it looks like the extra_css properties are not being applied.

If I:

Code:
ebook-convert my.recipe output && grep -ir "astyle" output/
To dump the OEB then grep for one of the custom styles, nothing is found. The documentation says extra_css should be placed in the <style></style> tags of the <head>. So I checked in output/index.html to be sure and nothing was placed their either.

I tried a few things like simplifying the extra_css and removing the no_stylesheets.

The modified recipe looks like:

Code:
# vim:ft=python

__license__ = 'GPL v3'
__copyright__ = '2010, James Kyle <james at jameskyle dot org>'

"""
Daily Blog Roll
"""

from calibre.web.feeds.recipes import BasicNewsRecipe
import re

class DailyBlogs(BasicNewsRecipe):
    title                 = u'Daily Blog Roll'
    description           = "Collection of Daily Blog Reading"
    oldest_article        = 1
    max_articles_per_feed = 5
    added_links           = []
    remove_tags           = [
        dict(name='a',   attrs={
            'class':'a2a_dd addtoany_share_save'}),

        dict(name='div', attrs={
            'class':['Introduction','divider']}),

        dict(name='div', attrs={
            'id':['feature', 'podcast']}),

        dict(name='div', attrs={
            'id':re.compile(r'follow.*', re.DOTALL|re.IGNORECASE)}),

        dict(name='hr'),
                             ]

    language              = 'en'
    remove_empty_feeds    = True
    remove_javascript     = True
    no_stylesheets        = True

    extra_css = """
h1 {
  font-family:Arial,Helvetica,sans-serif;
  font-weight:bold;
  font-size:large;
}

h2 {
  font-family:Arial,Helvetica,sans-serif;
  font-weight:normal;
  font-size: 2.6em;
}

p {
  font-family:Arial,Helvetica,sans-serif;
  font-size:small;
}

body {
  font-family:Helvetica,Arial,sans-serif;
  font-size:small;
}
"""

    feeds = [
(u'Weird Things',    u'feed://worldofweirdthings.com/feed/'),
(u'Bad Astronomy',   u'feed://feeds.feedburner.com/BadAstronomyBlog?format=xml'),
(u'Skepticblog',     u'feed://skepticblog.org/feed/'),
(u'The Skeptic',     u'http://www.skeptic.com/feed'),
(u'E-Skeptic',       u'http://www.skeptic.com/eskeptic'),
(u'All-SkepticBlog', u'http://skepticblog.org/feed'),
(u'Brian Dunning',   u'http://skepticblog.org/author/dunning/feed/'),
(u'Daniel Loxton',   u'http://skepticblog.org/author/loxton/feed/'),
(u'Kirsten Sanford', u'http://skepticblog.org/author/sanford/feed/'),
(u'Mark Edward',     u'http://skepticblog.org/author/edward/feed/'),
(u'Michael Shermer', u'http://skepticblog.org/author/shermer/feed/'),
(u'Phil Plait',      u'http://skepticblog.org/author/plait/feed/'),
(u'Ryan Johnson',    u'http://skepticblog.org/author/johnson/feed/'),
(u'Steven Novella',  u'http://skepticblog.org/author/novella/feed/'),
(u'Yau-Man Chan',    u'http://skepticblog.org/author/chan/feed/'),
        ]

    cover_url = "http://skepticblog.org/wp-content/uploads/Fairy_making_of_15_S.jpg"

    def get_browser(self):
      br = BasicNewsRecipe.get_browser(self)
      br.addheaders = [('Accept', 'text/html')]
      return br
krunk is offline