From 9e3903321281c8aacf3408ef2d27d5f746b83a37 Mon Sep 17 00:00:00 2001 From: Ondrej Grover Date: Sat, 10 May 2014 05:48:45 +0200 Subject: [PATCH] Fix #1342 replace intrasite links also in summary metadata Thanks to @Chimrod for pointing this out. --- pelican/contents.py | 3 ++- pelican/tests/test_contents.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 615a7fd8..b43b7258 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -278,7 +278,8 @@ class Content(object): content. """ if hasattr(self, '_summary'): - return self._summary + return self._update_content(self._summary, + self._context.get('localsiteurl', '')) if self.settings['SUMMARY_MAX_LENGTH'] is None: return self.content diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 3c0f8d75..ec554d4c 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -287,6 +287,19 @@ class TestPage(unittest.TestCase): '?utm_whatever=234&highlight=word#section-2">link' ) + # also test for summary in metadata + args['metadata']['summary'] = ( + 'A simple summary test, with a ' + 'link' + ) + args['context']['localsiteurl'] = 'http://notmyidea.org' + p = Page(**args) + self.assertEqual( + p.summary, + 'A simple summary test, with a ' + '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: