forked from github/pelican
Log a warning when the HTML reader encounters a nonconformant meta tag
Instead of throwing an exception and skipping the HTML file, log a warning with a message which makes it more obvious as to what happened.
This commit is contained in:
parent
455c159b48
commit
35375b19ff
4 changed files with 29 additions and 1 deletions
|
|
@ -302,7 +302,12 @@ class HTMLReader(BaseReader):
|
|||
return result + '>'
|
||||
|
||||
def _handle_meta_tag(self, attrs):
|
||||
name = self._attr_value(attrs, 'name').lower()
|
||||
name = self._attr_value(attrs, 'name')
|
||||
if name is None:
|
||||
attr_serialized = ', '.join(['{}="{}"'.format(k, v) for k, v in attrs])
|
||||
logger.warning("Meta tag in file %s does not have a 'name' attribute, skipping. Attributes: %s", self._filename, attr_serialized)
|
||||
return
|
||||
name = name.lower()
|
||||
contents = self._attr_value(attrs, 'content', '')
|
||||
if not contents:
|
||||
contents = self._attr_value(attrs, 'contents', '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue