Skip to content

Commit

Permalink
Fix-up
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer committed Jun 25, 2024
1 parent a62ba96 commit 03265ef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions docs/content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ author you can use ``author`` field.

If you do not explicitly specify summary metadata for a given post, the
``SUMMARY_MAX_LENGTH`` setting can be used to specify how many words from the
beginning of an article are used as the summary. You can also use the first N
paragraphs from the post as a summary using the ``SUMMARY_MAX_PARAGRAPHS``
setting. If both options are in use, the specified number of paragraphs will
be used but may be truncated to respect the specified max length.
beginning of an article are used as the summary. You can also use an article's
first N paragraphs as its summary using the ``SUMMARY_MAX_PARAGRAPHS`` setting.
If both settings are in use, the specified number of paragraphs will
be used but may be truncated to respect the specified maximum length.

You can also extract any metadata from the filename through a regular
expression to be set in the ``FILENAME_METADATA`` setting. All named groups
Expand Down
2 changes: 1 addition & 1 deletion docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Basic settings
.. data:: SUMMARY_MAX_PARAGRAPHS = None

When creating a short summary of an article, this will be the number of
paragraphs to use as the summary. This only applies if your content
paragraphs to use as the summary. This only applies if your content
does not otherwise specify a summary. Setting to ``None`` will cause the
summary to use the whole text (up to ``SUMMARY_MAX_LENGTH``) instead of just
the first N paragraphs.
Expand Down
6 changes: 3 additions & 3 deletions pelican/tests/test_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_summary_max_length(self):
self.assertEqual(page.summary, "")

def test_summary_paragraph(self):
# If a :SUMMARY_MAX_PARAGRAPHS: is set, the generated summary should
# If SUMMARY_MAX_PARAGRAPHS is set, the generated summary should
# not exceed the given paragraph count.
page_kwargs = self._copy_page_kwargs()
settings = get_settings()
Expand All @@ -129,8 +129,8 @@ def test_summary_paragraph(self):
self.assertEqual(page.summary, TEST_CONTENT)

def test_summary_paragraph_max_length(self):
# If a :SUMMARY_MAX_PARAGRAPHS: and :SUMMARY_MAX_LENGTH: are set, the
# generated summary should not exceed the given paragraph count and
# If both SUMMARY_MAX_PARAGRAPHS and SUMMARY_MAX_LENGTH are set,
# the generated summary should not exceed the given paragraph count and
# not exceed the given length.
page_kwargs = self._copy_page_kwargs()
settings = get_settings()
Expand Down
4 changes: 2 additions & 2 deletions pelican/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def truncate_html_words(s: str, num: int, end_text: str = "…") -> str:


def truncate_html_paragraphs(s, count):
"""Truncates HTML to a certain number of paragraphs.
"""Truncate HTML to a certain number of paragraphs.
:param count: number of paragraphs to keep
Expand All @@ -641,7 +641,7 @@ def truncate_html_paragraphs(s, count):
paragraphs = []
tag_stop = 0
substr = s[:]
for i in range(count):
for _ in range(count):
substr = substr[tag_stop:]
tag_start = substr.find("<p>")
tag_stop = substr.find("</p>") + len("</p>")
Expand Down

0 comments on commit 03265ef

Please sign in to comment.