diff --git a/src/calibre/manual/news_recipe.rst b/src/calibre/manual/news_recipe.rst index 6872d8e532..6eb47a26a1 100644 --- a/src/calibre/manual/news_recipe.rst +++ b/src/calibre/manual/news_recipe.rst @@ -54,6 +54,8 @@ Customizing e-book download .. automember:: BasicNewsRecipe.timefmt +.. automember:: basicNewsRecipe.conversion_options + .. automember:: BasicNewsRecipe.feeds .. automember:: BasicNewsRecipe.no_stylesheets diff --git a/src/calibre/web/feeds/input.py b/src/calibre/web/feeds/input.py index ee003be0da..3052ffebed 100644 --- a/src/calibre/web/feeds/input.py +++ b/src/calibre/web/feeds/input.py @@ -57,6 +57,8 @@ class RecipeInput(InputFormatPlugin): ro = recipe(opts, log, self.report_progress) ro.download() + for key, val in recipe.conversion_options.items(): + setattr(opts, key, val) opts.output_profile.flow_size = 0 diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 3f6b9b9ae1..eca8eb0c93 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -156,13 +156,16 @@ class BasicNewsRecipe(Recipe): #: :attr:`BasicNewsRecipe.filter_regexps` should be defined. filter_regexps = [] - #: List of options to pass to html2lrf, to customize generation of LRF ebooks. - html2lrf_options = [] - - #: Options to pass to html2epub to customize generation of EPUB ebooks. - html2epub_options = '' - #: Options to pass to oeb2mobi to customize generation of MOBI ebooks. - oeb2mobi_options = '' + #: Recipe specific options to control the conversion of the downloaded + #: content into an e-book. These will override any user or plugin specified + #: values, so only use if absolutely necessary. For example: + #: conversion_options = { + #: 'base_font_size' : 16, + #: 'tags' : 'mytag1,mytag2', + #: 'title' : 'My Title', + #: 'linearize_tables' : True, + #: } + conversion_options = {} #: List of tags to be removed. Specified tags are removed from downloaded HTML. #: A tag is specified as a dictionary of the form:: diff --git a/src/calibre/web/feeds/recipes/recipe_barrons.py b/src/calibre/web/feeds/recipes/recipe_barrons.py index 164be20d3e..f9f501a9c3 100644 --- a/src/calibre/web/feeds/recipes/recipe_barrons.py +++ b/src/calibre/web/feeds/recipes/recipe_barrons.py @@ -1,76 +1,76 @@ ## -## web2lrf profile to download articles from Barrons.com -## can download subscriber-only content if username and +## web2lrf profile to download articles from Barrons.com +## can download subscriber-only content if username and ## password are supplied. ## -''' -''' - -import re - -from calibre.web.feeds.news import BasicNewsRecipe - -class Barrons(BasicNewsRecipe): - - title = 'Barron\'s' +''' +''' + +import re + +from calibre.web.feeds.news import BasicNewsRecipe + +class Barrons(BasicNewsRecipe): + + title = 'Barron\'s' max_articles_per_feed = 50 needs_subscription = True language = _('English') __author__ = 'Kovid Goyal' description = 'Weekly publication for investors from the publisher of the Wall Street Journal' - timefmt = ' [%a, %b %d, %Y]' - use_embedded_content = False + timefmt = ' [%a, %b %d, %Y]' + use_embedded_content = False no_stylesheets = False match_regexps = ['http://online.barrons.com/.*?html\?mod=.*?|file:.*'] - html2lrf_options = [('--ignore-tables'),('--base-font-size=10')] + conversion_options = {'linearize_tables': True} ##delay = 1 - - ## Don't grab articles more than 7 days old - oldest_article = 7 + + ## Don't grab articles more than 7 days old + oldest_article = 7 - preprocess_regexps = [(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in - [ - ## Remove anything before the body of the article. - (r'