Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2072 from getnikola/fixing-atom-feed-renderer
Making sure all parts of an Atom feed is rendered for the correct language.
  • Loading branch information
ralsina committed Sep 12, 2015
2 parents bce97f0 + cc0b8cc commit 591a60b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nikola/nikola.py
Expand Up @@ -1800,6 +1800,7 @@ def atom_link(link_rel, link_type, link_href):
link.set("href", utils.encodelink(link_href))
return link

utils.LocaleBorg().set_locale(lang)
deps = []
uptodate_deps = []
for post in posts:
Expand Down Expand Up @@ -1885,7 +1886,7 @@ def atom_link(link_rel, link_type, link_href):
# FIXME: this is duplicated with code in Post.text() and generic_rss_renderer
try:
doc = lxml.html.document_fromstring(data)
doc.rewrite_links(lambda dst: self.url_replacer(post.permalink(), dst, lang, 'absolute'))
doc.rewrite_links(lambda dst: self.url_replacer(post.permalink(lang), dst, lang, 'absolute'))
try:
body = doc.body
data = (body.text or '') + ''.join(
Expand Down Expand Up @@ -1922,7 +1923,7 @@ def atom_link(link_rel, link_type, link_href):
entry_content.set("type", "xhtml")
entry_content_nsdiv = lxml.etree.SubElement(entry_content, "{http://www.w3.org/1999/xhtml}div")
entry_content_nsdiv.text = data
for category in post.tags:
for category in post.tags_for_language(lang):
entry_category = lxml.etree.SubElement(entry_root, "category")
entry_category.set("term", utils.slugify(category))
entry_category.set("label", category)
Expand Down

0 comments on commit 591a60b

Please sign in to comment.