mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Allow HTML files with meta tags that don't have a "name" and "content" field to be read by the HTMLReader.
For example, "<meta charset="utf-8" />" might appear in an HTML document. Without this change, this causes an exception.
This commit is contained in:
parent
cc15629966
commit
4fbf4b2638
1 changed files with 7 additions and 5 deletions
|
|
@ -270,12 +270,14 @@ class HTMLReader(Reader):
|
|||
return result + '>'
|
||||
|
||||
def _handle_meta_tag(self, attrs):
|
||||
name = self._attr_value(attrs, 'name').lower()
|
||||
contents = self._attr_value(attrs, 'contents', '')
|
||||
name = self._attr_value(attrs, 'name')
|
||||
if name:
|
||||
name = name.lower()
|
||||
contents = self._attr_value(attrs, 'contents', '')
|
||||
|
||||
if name == 'keywords':
|
||||
name = 'tags'
|
||||
self.metadata[name] = contents
|
||||
if name == 'keywords':
|
||||
name = 'tags'
|
||||
self.metadata[name] = contents
|
||||
|
||||
@classmethod
|
||||
def _attr_value(cls, attrs, name, default=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue