mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2288 from charlesfleche/fix-metadata-intrasite-links-squashed
Fix intrasite links for non-'summary' metadata
Metadata like `MyArticleBanner: ` would be properly parsed (as defined in `FORMATTED_FIELDS`), but the intrasite links would not be processed.
Only the summary gets its intrasite links processed, has its value is either generated from the content (calling self._update_content at some point) or self._update_content is explicitly called if summary is passed as metadata.
This PR expands the paths as soon as possible in (`Content.__init__`) for metadata defined in `FORMATTED_FIELDS`.
This commit is contained in:
commit
2d24d6b997
4 changed files with 42 additions and 10 deletions
|
|
@ -319,17 +319,21 @@ class TestPage(LoggedTestCase):
|
|||
)
|
||||
|
||||
# also test for summary in metadata
|
||||
args['metadata']['summary'] = (
|
||||
parsed = (
|
||||
'A simple summary test, with a '
|
||||
'<a href="|filename|article.rst">link</a>'
|
||||
)
|
||||
args['context']['localsiteurl'] = 'http://notmyidea.org'
|
||||
p = Page(**args)
|
||||
self.assertEqual(
|
||||
p.summary,
|
||||
linked = (
|
||||
'A simple summary test, with a '
|
||||
'<a href="http://notmyidea.org/article.html">link</a>'
|
||||
)
|
||||
args['settings']['FORMATTED_FIELDS'] = ['summary', 'custom']
|
||||
args['metadata']['summary'] = parsed
|
||||
args['metadata']['custom'] = parsed
|
||||
args['context']['localsiteurl'] = 'http://notmyidea.org'
|
||||
p = Page(**args)
|
||||
self.assertEqual(p.summary, linked)
|
||||
self.assertEqual(p.custom, linked)
|
||||
|
||||
def test_intrasite_link_more(self):
|
||||
# type does not take unicode in PY2 and bytes in PY3, which in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue