mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Allow recipes to specify overrides for conversion options
This commit is contained in:
parent
9b170e6c95
commit
2e0ad5d1e0
@ -54,6 +54,8 @@ Customizing e-book download
|
|||||||
|
|
||||||
.. automember:: BasicNewsRecipe.timefmt
|
.. automember:: BasicNewsRecipe.timefmt
|
||||||
|
|
||||||
|
.. automember:: basicNewsRecipe.conversion_options
|
||||||
|
|
||||||
.. automember:: BasicNewsRecipe.feeds
|
.. automember:: BasicNewsRecipe.feeds
|
||||||
|
|
||||||
.. automember:: BasicNewsRecipe.no_stylesheets
|
.. automember:: BasicNewsRecipe.no_stylesheets
|
||||||
|
@ -57,6 +57,8 @@ class RecipeInput(InputFormatPlugin):
|
|||||||
|
|
||||||
ro = recipe(opts, log, self.report_progress)
|
ro = recipe(opts, log, self.report_progress)
|
||||||
ro.download()
|
ro.download()
|
||||||
|
for key, val in recipe.conversion_options.items():
|
||||||
|
setattr(opts, key, val)
|
||||||
|
|
||||||
opts.output_profile.flow_size = 0
|
opts.output_profile.flow_size = 0
|
||||||
|
|
||||||
|
@ -156,13 +156,16 @@ class BasicNewsRecipe(Recipe):
|
|||||||
#: :attr:`BasicNewsRecipe.filter_regexps` should be defined.
|
#: :attr:`BasicNewsRecipe.filter_regexps` should be defined.
|
||||||
filter_regexps = []
|
filter_regexps = []
|
||||||
|
|
||||||
#: List of options to pass to html2lrf, to customize generation of LRF ebooks.
|
#: Recipe specific options to control the conversion of the downloaded
|
||||||
html2lrf_options = []
|
#: content into an e-book. These will override any user or plugin specified
|
||||||
|
#: values, so only use if absolutely necessary. For example:
|
||||||
#: Options to pass to html2epub to customize generation of EPUB ebooks.
|
#: conversion_options = {
|
||||||
html2epub_options = ''
|
#: 'base_font_size' : 16,
|
||||||
#: Options to pass to oeb2mobi to customize generation of MOBI ebooks.
|
#: 'tags' : 'mytag1,mytag2',
|
||||||
oeb2mobi_options = ''
|
#: 'title' : 'My Title',
|
||||||
|
#: 'linearize_tables' : True,
|
||||||
|
#: }
|
||||||
|
conversion_options = {}
|
||||||
|
|
||||||
#: List of tags to be removed. Specified tags are removed from downloaded HTML.
|
#: List of tags to be removed. Specified tags are removed from downloaded HTML.
|
||||||
#: A tag is specified as a dictionary of the form::
|
#: A tag is specified as a dictionary of the form::
|
||||||
|
@ -22,7 +22,7 @@ class Barrons(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
no_stylesheets = False
|
no_stylesheets = False
|
||||||
match_regexps = ['http://online.barrons.com/.*?html\?mod=.*?|file:.*']
|
match_regexps = ['http://online.barrons.com/.*?html\?mod=.*?|file:.*']
|
||||||
html2lrf_options = [('--ignore-tables'),('--base-font-size=10')]
|
conversion_options = {'linearize_tables': True}
|
||||||
##delay = 1
|
##delay = 1
|
||||||
|
|
||||||
## Don't grab articles more than 7 days old
|
## Don't grab articles more than 7 days old
|
||||||
|
@ -13,8 +13,7 @@ class Winsupersite(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
html2lrf_options = ['--ignore-tables']
|
conversion_options = {'linearize_tables' : True}
|
||||||
html2epub_options = 'linearize_tables = True'
|
|
||||||
remove_tags_before = dict(name='h1')
|
remove_tags_before = dict(name='h1')
|
||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'<p>--Paul Thurrott.*</body>', re.DOTALL|re.IGNORECASE),
|
(re.compile(r'<p>--Paul Thurrott.*</body>', re.DOTALL|re.IGNORECASE),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user