forked from github/pelican
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
|
||||
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
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ class Content:
|
|||
|
||||
return truncate_html_words(self.content,
|
||||
self.settings['SUMMARY_MAX_LENGTH'],
|
||||
self.settings['SUMMARY_END_MARKER'])
|
||||
self.settings['SUMMARY_END_SUFFIX'])
|
||||
|
||||
@property
|
||||
def summary(self):
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ DEFAULT_CONFIG = {
|
|||
'TYPOGRIFY': False,
|
||||
'TYPOGRIFY_IGNORE_TAGS': [],
|
||||
'TYPOGRIFY_DASHES': 'default',
|
||||
'SUMMARY_END_MARKER': '…',
|
||||
'SUMMARY_END_SUFFIX': '…',
|
||||
'SUMMARY_MAX_LENGTH': 50,
|
||||
'PLUGIN_PATHS': [],
|
||||
'PLUGINS': None,
|
||||
|
|
|
|||
|
|
@ -110,14 +110,14 @@ class TestPage(TestBase):
|
|||
page = Page(**page_kwargs)
|
||||
self.assertEqual(page.summary, '')
|
||||
|
||||
def test_summary_end_marker(self):
|
||||
# If a :SUMMARY_END_MARKER: is set, and there is no other summary,
|
||||
def test_summary_end_suffix(self):
|
||||
# If a :SUMMARY_END_SUFFIX: is set, and there is no other summary,
|
||||
# generated summary should contain the specified marker at the end.
|
||||
page_kwargs = self._copy_page_kwargs()
|
||||
settings = get_settings()
|
||||
page_kwargs['settings'] = settings
|
||||
del page_kwargs['metadata']['summary']
|
||||
settings['SUMMARY_END_MARKER'] = 'test_marker'
|
||||
settings['SUMMARY_END_SUFFIX'] = 'test_marker'
|
||||
settings['SUMMARY_MAX_LENGTH'] = 10
|
||||
page = Page(**page_kwargs)
|
||||
self.assertEqual(page.summary, truncate_html_words(TEST_CONTENT, 10,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue