Add output language support

This commit is contained in:
Gregory Soutade
2022-10-08 16:08:02 +02:00
parent c5744585c7
commit 27bd360abe
9 changed files with 31 additions and 11 deletions

View File

@@ -319,6 +319,9 @@ class Index(DynastieGenerator):
except:
pass
if post.language != None:
post_elem.setAttribute('lang', post.language.abbrev)
self.parent_posts = []
post_content = self._loadPostContent(post)
if not post_content: return None

View File

@@ -134,7 +134,13 @@ class Post(Index):
new_elem = self.createMeta(dom, name, post.author.first_name + ' ' + post.author.last_name)
except:
return None
elif name == 'lang':
meta_elem.removeChild(root)
# Add attribute lang in <html> tag
if post.language != None:
meta_elem.parentNode.setAttribute('lang', post.language.abbrev)
return None
if not new_elem is None:
root.parentNode.replaceChild(new_elem, root)
return new_elem