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