diff --git a/utils.py b/utils.py index 11d00aa0..b653d280 100644 --- a/utils.py +++ b/utils.py @@ -19,18 +19,6 @@ from calendar import monthrange from followingCalendar import addPersonToCalendar -def firstParagraphFromString(content: str) -> str: - """Get the first paragraph from a blog post - to be used as a summary in the newswire feed - """ - if '

' not in content or '

' not in content: - return removeHtml(content) - paragraph = content.split('

')[1] - if '

' in paragraph: - paragraph = paragraph.split('

')[0] - return removeHtml(paragraph) - - def removeHtml(content: str) -> str: """Removes html links from the given content. Used to ensure that profile descriptions don't contain dubious content @@ -50,6 +38,18 @@ def removeHtml(content: str) -> str: return result +def firstParagraphFromString(content: str) -> str: + """Get the first paragraph from a blog post + to be used as a summary in the newswire feed + """ + if '

' not in content or '

' not in content: + return removeHtml(content) + paragraph = content.split('

')[1] + if '

' in paragraph: + paragraph = paragraph.split('

')[0] + return removeHtml(paragraph) + + def isSystemAccount(nickname: str) -> bool: """Returns true if the given nickname is a system account """