From 61f3bb1a6e7828340b8dec1c61ba148c4c9b5c94 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 1 Oct 2018 15:00:53 -0500 Subject: [PATCH] Filter down the cover options to valid ones --- ebook/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ebook/__init__.py b/ebook/__init__.py index c69d7aa..31d6f52 100644 --- a/ebook/__init__.py +++ b/ebook/__init__.py @@ -102,7 +102,8 @@ def generate_epub(story, cover_options={}, output_filename=None): 'updated': max(dates), } - cover_options = CoverOptions(**cover_options) + valid_cover_options = ('fontname', 'fontsize', 'width', 'height', 'wrapat', 'bgcolor', 'textcolor', 'cover_url') + cover_options = CoverOptions(**{k: v for k, v in cover_options.items() if k in valid_cover_options}) cover_options = attr.asdict(cover_options, filter=lambda k, v: v is not None, retain_collection_types=True) # The cover is static, and the only change comes from the image which we generate