From 03f8447a10af4c113f5fed809411a68a9aab0c53 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2013 21:16:34 +0530 Subject: [PATCH] What If by kisnick --- recipes/what_if.recipe | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 recipes/what_if.recipe diff --git a/recipes/what_if.recipe b/recipes/what_if.recipe new file mode 100644 index 0000000000..1d642353d2 --- /dev/null +++ b/recipes/what_if.recipe @@ -0,0 +1,24 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class XkcdCom(BasicNewsRecipe): + cover_url = 'http://what-if.xkcd.com/imgs/whatif-logo.png' + masthead_url = 'http://what-if.xkcd.com/imgs/whatif-logo.png' + __author__ = 'kisnik' + title = 'What If...' + description = 'The "What If" feed from xkcd' + language = 'en' + keep_only_tags = [dict(name='article')] + + use_embedded_content = False + oldest_article = 60 + # add image and text + # add an horizontal line after the question + preprocess_regexps = [ + (re.compile(r'()'), + lambda m: '
%s%s

(%s)

' % (m.group(1), m.group(3), m.group(2))), + (re.compile(r'([^>]+

)'), + lambda n: '%s
' % (n.group(1))), + ] + + extra_css = "#photo_text{font-size:small;}"