Don't generate HTML/CSS wrapper for the content unless the output is a

destination file (HTML/PDF).
This commit is contained in:
Fabio Manganiello 2019-07-25 18:08:18 +02:00
parent 34433a363b
commit 83db3f770c

View file

@ -68,9 +68,7 @@ class HttpWebpagePlugin(Plugin):
'Published' if response.get('date_published') else 'Generated', 'Published' if response.get('date_published') else 'Generated',
response.get('date_published', datetime.datetime.now().isoformat()))) response.get('date_published', datetime.datetime.now().isoformat())))
content = '<body style="{body_style}"><h1>{title}</h1>{content}</body>'.\ content = response.get('content', '')
format(title=title, content=response.get('content', '[No content available]'),
body_style='font-size: 22px; font-family: Tahoma, Geneva, sans-serif')
if not outfile: if not outfile:
return { return {
@ -79,6 +77,10 @@ class HttpWebpagePlugin(Plugin):
'content': content, 'content': content,
} }
content = '<body style="{body_style}"><h1>{title}</h1>{content}</body>'. \
format(title=title, content=content,
body_style='font-size: 22px; font-family: Tahoma, Geneva, Verdana, Helvetica, sans-serif')
outfile = os.path.abspath(os.path.expanduser(outfile)) outfile = os.path.abspath(os.path.expanduser(outfile))
if outfile.lower().endswith('.pdf'): if outfile.lower().endswith('.pdf'):