Skip to content
Permalink
Browse files
Fix #2890 — Ignore empty tags in HTML metadata reader
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 24, 2017
1 parent dd5e8a7 commit bc4ef229166de5ed08f8de9a19981cb1a7747283
Showing with 5 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +4 −2 nikola/plugins/compile/html.py
@@ -1,6 +1,7 @@
New in v7-maintenance
=====================

* Ignore empty tags in HTML metadata reader (Issue #2890)
* Fix crash when compiling empty ``.html`` posts (Issue #2851)

New in v7.8.9
@@ -106,7 +106,7 @@ def read_metadata(self, post, file_metadata_regexp=None, unslugify_titles=False,
# let other errors raise
raise
title_tag = doc.find('*//title')
if title_tag is not None:
if title_tag is not None and title_tag.text:
metadata['title'] = title_tag.text
meta_tags = doc.findall('*//meta')
for tag in meta_tags:
@@ -115,6 +115,8 @@ def read_metadata(self, post, file_metadata_regexp=None, unslugify_titles=False,
continue
elif k == 'keywords':
k = 'tags'
metadata[k] = tag.get('content', '')
content = tag.get('content')
if content:
metadata[k] = content
map_metadata(metadata, 'html_metadata', self.site.config)
return metadata

0 comments on commit bc4ef22

Please sign in to comment.