Skip to content

Commit

Permalink
Separate any HTML tag join with a new line
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb committed Jan 23, 2025
1 parent 6e1ba7d commit c19915e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
]


def strip_tags_with_spaces(string):
spaced = string.replace("><", "> <")
def strip_tags_with_newlines(string):
spaced = string.replace("><", ">\n<")
return strip_tags(spaced)


Expand Down Expand Up @@ -504,7 +504,7 @@ def _generate_excerpt(self):
[str(b.value) for b in self.body if b.block_type == "text_section"]
)
self.excerpt = truncate_words_and_chars(
text=html.unescape(strip_tags_with_spaces(content)),
text=html.unescape(strip_tags_with_newlines(content)),
)

def save(self, *args, **kwargs):
Expand Down

0 comments on commit c19915e

Please sign in to comment.