diff --git a/pelican/contents.py b/pelican/contents.py index dbc33716..059c54a7 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -189,8 +189,8 @@ class Content(object): instrasite_link_regex = self.settings['INTRASITE_LINK_REGEX'] regex = r""" - (?P<\s*[^\>]* # match tag with src and href attr - (?:href|src)\s*=) + (?P<\s*[^\>]* # match tag with all url-value attributes + (?:href|src|poster|data|cite|formaction|action)\s*=) (?P["\']) # require value to be quoted (?P{0}(?P.*?)) # the url value diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 9c894ffc..92e61355 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -268,6 +268,61 @@ class TestPage(unittest.TestCase): '?utm_whatever=234&highlight=word#section-2">link' ) + def test_intrasite_link_more(self): + # type does not take unicode in PY2 and bytes in PY3, which in + # combination with unicode literals leads to following insane line: + cls_name = '_DummyAsset' if six.PY3 else b'_DummyAsset' + + args = self.page_kwargs.copy() + args['settings'] = get_settings() + args['source_path'] = 'content' + args['context']['filenames'] = { + 'images/poster.jpg': type(cls_name, (object,), {'url': 'images/poster.jpg'}), + 'assets/video.mp4': type(cls_name, (object,), {'url': 'assets/video.mp4'}), + 'images/graph.svg': type(cls_name, (object,), {'url': 'images/graph.svg'}), + 'reference.rst': type(cls_name, (object,), {'url': 'reference.html'}), + } + + # video.poster + args['content'] = ( + 'There is a video with poster ' + '' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a video with poster ' + '' + ) + + # object.data + args['content'] = ( + 'There is a svg object ' + '' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a svg object ' + '' + ) + + # blockquote.cite + args['content'] = ( + 'There is a blockquote with cite attribute ' + '
blah blah
' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a blockquote with cite attribute ' + '
blah blah
' + ) + class TestArticle(TestPage): def test_template(self):