mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Rename setting SUMMARY_END_MARKER → SUMMARY_END_SUFFIX (#2792)
Avoids clash with 'summary' plugin. Refs: https://github.com/getpelican/pelican-plugins/pull/1284#issuecomment-660715086
This commit is contained in:
parent
ade70cb2e2
commit
64fcdb5172
4 changed files with 7 additions and 7 deletions
|
|
@ -303,10 +303,10 @@ Basic settings
|
||||||
does not otherwise specify a summary. Setting to ``None`` will cause the
|
does not otherwise specify a summary. Setting to ``None`` will cause the
|
||||||
summary to be a copy of the original content.
|
summary to be a copy of the original content.
|
||||||
|
|
||||||
.. data:: SUMMARY_END_MARKER = '…'
|
.. data:: SUMMARY_END_SUFFIX = '…'
|
||||||
|
|
||||||
When creating a short summary of an article and the result was truncated to
|
When creating a short summary of an article and the result was truncated to
|
||||||
match the required word length, this will be used as the truncation marker.
|
match the required word length, this will be used as the truncation suffix.
|
||||||
|
|
||||||
.. data:: WITH_FUTURE_DATES = True
|
.. data:: WITH_FUTURE_DATES = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ class Content:
|
||||||
|
|
||||||
return truncate_html_words(self.content,
|
return truncate_html_words(self.content,
|
||||||
self.settings['SUMMARY_MAX_LENGTH'],
|
self.settings['SUMMARY_MAX_LENGTH'],
|
||||||
self.settings['SUMMARY_END_MARKER'])
|
self.settings['SUMMARY_END_SUFFIX'])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def summary(self):
|
def summary(self):
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ DEFAULT_CONFIG = {
|
||||||
'TYPOGRIFY': False,
|
'TYPOGRIFY': False,
|
||||||
'TYPOGRIFY_IGNORE_TAGS': [],
|
'TYPOGRIFY_IGNORE_TAGS': [],
|
||||||
'TYPOGRIFY_DASHES': 'default',
|
'TYPOGRIFY_DASHES': 'default',
|
||||||
'SUMMARY_END_MARKER': '…',
|
'SUMMARY_END_SUFFIX': '…',
|
||||||
'SUMMARY_MAX_LENGTH': 50,
|
'SUMMARY_MAX_LENGTH': 50,
|
||||||
'PLUGIN_PATHS': [],
|
'PLUGIN_PATHS': [],
|
||||||
'PLUGINS': None,
|
'PLUGINS': None,
|
||||||
|
|
|
||||||
|
|
@ -110,14 +110,14 @@ class TestPage(TestBase):
|
||||||
page = Page(**page_kwargs)
|
page = Page(**page_kwargs)
|
||||||
self.assertEqual(page.summary, '')
|
self.assertEqual(page.summary, '')
|
||||||
|
|
||||||
def test_summary_end_marker(self):
|
def test_summary_end_suffix(self):
|
||||||
# If a :SUMMARY_END_MARKER: is set, and there is no other summary,
|
# If a :SUMMARY_END_SUFFIX: is set, and there is no other summary,
|
||||||
# generated summary should contain the specified marker at the end.
|
# generated summary should contain the specified marker at the end.
|
||||||
page_kwargs = self._copy_page_kwargs()
|
page_kwargs = self._copy_page_kwargs()
|
||||||
settings = get_settings()
|
settings = get_settings()
|
||||||
page_kwargs['settings'] = settings
|
page_kwargs['settings'] = settings
|
||||||
del page_kwargs['metadata']['summary']
|
del page_kwargs['metadata']['summary']
|
||||||
settings['SUMMARY_END_MARKER'] = 'test_marker'
|
settings['SUMMARY_END_SUFFIX'] = 'test_marker'
|
||||||
settings['SUMMARY_MAX_LENGTH'] = 10
|
settings['SUMMARY_MAX_LENGTH'] = 10
|
||||||
page = Page(**page_kwargs)
|
page = Page(**page_kwargs)
|
||||||
self.assertEqual(page.summary, truncate_html_words(TEST_CONTENT, 10,
|
self.assertEqual(page.summary, truncate_html_words(TEST_CONTENT, 10,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue