Skip to content
Browse files
  • Loading branch information
felixfontein committed Oct 23, 2016
1 parent 9fbb5bf commit 0280de31588b86db67e23456aa313ade85748d85
Showing with 7 additions and 3 deletions.
  1. +2 −2 CHANGES.txt
  2. +5 −1 nikola/
@@ -9,15 +9,15 @@ Bugfixes

* ``render_template`` and ``generic_renderer`` can now create HTML
* 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

New in v7.8.1
@@ -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)'))
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(',')]

0 comments on commit 0280de3

Please sign in to comment.