Skip to content

Commit 0280de3

Browse files
committedOct 23, 2016
Improvements.
1 parent 9fbb5bf commit 0280de3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎CHANGES.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Bugfixes
99
Features
1010
--------
1111

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

2222
New in v7.8.1
2323
=============

‎nikola/nikola.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,11 @@ def rewrite_links(self, doc, src, lang, url_type=None, is_fragment=False):
13551355
doc.rewrite_links(lambda dst: self.url_replacer(src, dst, lang, url_type), resolve_base_href=False)
13561356

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

0 commit comments

Comments
 (0)
Failed to load comments.