Skip to content

Commit

Permalink
Improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Oct 23, 2016
1 parent 9fbb5bf commit 0280de3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGES.txt
Expand Up @@ -9,15 +9,15 @@ Bugfixes
Features
--------

* ``render_template`` and ``generic_renderer`` can now create HTML
fragments.
* Allow posts to set custom ``URL_TYPE`` by using the ``url_type``
meta tag (useful for HTML fragments inserted using JavaScript)
* Plugins can depend on other plugins being installed (Issue #2533)
* The destination folder in ``POSTS`` and ``PAGES`` can now be
translated (Issue #2116)
* Pass ``post`` object and ``lang`` to post compilers (Issue #2531)
* Pass ``url_type`` into template's context.
* ``render_template`` and ``generic_renderer`` can now create HTML
fragments.

New in v7.8.1
=============
Expand Down
6 changes: 5 additions & 1 deletion nikola/nikola.py
Expand Up @@ -1355,7 +1355,11 @@ def rewrite_links(self, doc, src, lang, url_type=None, is_fragment=False):
doc.rewrite_links(lambda dst: self.url_replacer(src, dst, lang, url_type), resolve_base_href=False)

# lxml ignores srcset in img and source elements, so do that by hand
objs = list(doc.xpath('({0}//img|{0}//source)'.format('' if is_fragment else '*')))
if is_fragment:
# With the asterisk, top-level <img> and <source> tags are not found
objs = list(doc.xpath('(//img|//source)'))
else:
objs = list(doc.xpath('(*//img|*//source)'))
for obj in objs:
if 'srcset' in obj.attrib:
urls = [u.strip() for u in obj.attrib['srcset'].split(',')]
Expand Down

0 comments on commit 0280de3

Please sign in to comment.