mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
501feef616
commit
682a6755e0
6
blog.py
6
blog.py
|
@ -30,7 +30,7 @@ from utils import getNicknameFromActor
|
|||
from utils import getDomainFromActor
|
||||
from utils import locate_post
|
||||
from utils import load_json
|
||||
from utils import firstParagraphFromString
|
||||
from utils import first_paragraph_from_string
|
||||
from utils import get_actor_property_url
|
||||
from utils import acct_dir
|
||||
from posts import createBlogsTimeline
|
||||
|
@ -370,7 +370,7 @@ def _htmlBlogPostRSS2(authorized: bool,
|
|||
content = \
|
||||
get_base_content_from_post(post_json_object,
|
||||
system_language)
|
||||
description = firstParagraphFromString(content)
|
||||
description = first_paragraph_from_string(content)
|
||||
rssStr = ' <item>'
|
||||
rssStr += ' <title>' + titleStr + '</title>'
|
||||
rssStr += ' <link>' + messageLink + '</link>'
|
||||
|
@ -405,7 +405,7 @@ def _htmlBlogPostRSS3(authorized: bool,
|
|||
content = \
|
||||
get_base_content_from_post(post_json_object,
|
||||
system_language)
|
||||
description = firstParagraphFromString(content)
|
||||
description = first_paragraph_from_string(content)
|
||||
rssStr = 'title: ' + titleStr + '\n'
|
||||
rssStr += 'link: ' + messageLink + '\n'
|
||||
rssStr += 'description: ' + description + '\n'
|
||||
|
|
|
@ -279,7 +279,7 @@ from utils import is_artist
|
|||
from utils import get_image_extensions
|
||||
from utils import media_file_mime_type
|
||||
from utils import getCSS
|
||||
from utils import firstParagraphFromString
|
||||
from utils import first_paragraph_from_string
|
||||
from utils import clearFromPostCaches
|
||||
from utils import containsInvalidChars
|
||||
from utils import is_system_account
|
||||
|
@ -4648,7 +4648,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.newswire[publishedDate][0] = \
|
||||
newsPostTitle
|
||||
self.server.newswire[publishedDate][4] = \
|
||||
firstParagraphFromString(newsPostContent)
|
||||
first_paragraph_from_string(newsPostContent)
|
||||
# save newswire
|
||||
newswireStateFilename = \
|
||||
base_dir + '/accounts/.newswirestate.json'
|
||||
|
|
|
@ -22,7 +22,7 @@ from utils import dangerousSVG
|
|||
from utils import get_fav_filename_from_url
|
||||
from utils import get_base_content_from_post
|
||||
from utils import has_object_dict
|
||||
from utils import firstParagraphFromString
|
||||
from utils import first_paragraph_from_string
|
||||
from utils import isPublicPost
|
||||
from utils import locate_post
|
||||
from utils import load_json
|
||||
|
@ -946,7 +946,7 @@ def getRSSfromDict(base_dir: str, newswire: {},
|
|||
rssStr += \
|
||||
'<item>\n' + \
|
||||
' <title>' + fields[0] + '</title>\n'
|
||||
description = remove_html(firstParagraphFromString(fields[4]))
|
||||
description = remove_html(first_paragraph_from_string(fields[4]))
|
||||
rssStr += ' <description>' + description + '</description>\n'
|
||||
url = fields[1]
|
||||
if '://' not in url:
|
||||
|
@ -1064,7 +1064,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
|
|||
content = \
|
||||
get_base_content_from_post(post_json_object,
|
||||
system_language)
|
||||
description = firstParagraphFromString(content)
|
||||
description = first_paragraph_from_string(content)
|
||||
description = remove_html(description)
|
||||
tagsFromPost = _getHashtagsFromPost(post_json_object)
|
||||
summary = post_json_object['object']['summary']
|
||||
|
|
6
tests.py
6
tests.py
|
@ -71,7 +71,7 @@ from utils import camel_case_split
|
|||
from utils import decoded_host
|
||||
from utils import get_full_domain
|
||||
from utils import validNickname
|
||||
from utils import firstParagraphFromString
|
||||
from utils import first_paragraph_from_string
|
||||
from utils import remove_id_ending
|
||||
from utils import updateRecentPostsCache
|
||||
from utils import followPerson
|
||||
|
@ -4154,13 +4154,13 @@ def _testFirstParagraphFromString():
|
|||
testStr = \
|
||||
'<p><a href="https://somesite.com/somepath">This is a test</a></p>' + \
|
||||
'<p>This is another paragraph</p>'
|
||||
resultStr = firstParagraphFromString(testStr)
|
||||
resultStr = first_paragraph_from_string(testStr)
|
||||
if resultStr != 'This is a test':
|
||||
print(resultStr)
|
||||
assert resultStr == 'This is a test'
|
||||
|
||||
testStr = 'Testing without html'
|
||||
resultStr = firstParagraphFromString(testStr)
|
||||
resultStr = first_paragraph_from_string(testStr)
|
||||
assert resultStr == testStr
|
||||
|
||||
|
||||
|
|
2
utils.py
2
utils.py
|
@ -474,7 +474,7 @@ def remove_html(content: str) -> str:
|
|||
return result
|
||||
|
||||
|
||||
def firstParagraphFromString(content: str) -> str:
|
||||
def first_paragraph_from_string(content: str) -> str:
|
||||
"""Get the first paragraph from a blog post
|
||||
to be used as a summary in the newswire feed
|
||||
"""
|
||||
|
|
|
@ -21,7 +21,7 @@ from utils import getDomainFromActor
|
|||
from utils import getNicknameFromActor
|
||||
from utils import locate_post
|
||||
from utils import isPublicPost
|
||||
from utils import firstParagraphFromString
|
||||
from utils import first_paragraph_from_string
|
||||
from utils import searchBoxPosts
|
||||
from utils import get_alt_path
|
||||
from utils import acct_dir
|
||||
|
@ -989,7 +989,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
|||
description = \
|
||||
get_base_content_from_post(post_json_object,
|
||||
system_language)
|
||||
description = firstParagraphFromString(description)
|
||||
description = first_paragraph_from_string(description)
|
||||
hashtagFeed += \
|
||||
' <description>' + description + '</description>'
|
||||
hashtagFeed += \
|
||||
|
|
Loading…
Reference in New Issue