0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 22:13:53 +01:00

Spelling.

This commit is contained in:
Erik Johnston 2016-08-02 18:37:31 +01:00
parent f83f5fbce8
commit 9e66c58ceb

View file

@ -373,7 +373,7 @@ class PreviewUrlResource(Resource):
new_desc = "" new_desc = ""
# This splits the paragraph into words, but keeping the # This splits the paragraph into words, but keeping the
# (proceeding) whitespace intact so we can easily concat # (preceeding) whitespace intact so we can easily concat
# words back together. # words back together.
for match in re.finditer("\s*\S+", description): for match in re.finditer("\s*\S+", description):
word = match.group() word = match.group()
@ -383,7 +383,7 @@ class PreviewUrlResource(Resource):
if len(word) + len(new_desc) < MAX_SIZE: if len(word) + len(new_desc) < MAX_SIZE:
new_desc += word new_desc += word
else: else:
# At thi point the next word *will* take us over # At this point the next word *will* take us over
# MAX_SIZE, but we also want to ensure that its not # MAX_SIZE, but we also want to ensure that its not
# a huge word. If it is add it anyway and we'll # a huge word. If it is add it anyway and we'll
# truncate later. # truncate later.
@ -396,7 +396,7 @@ class PreviewUrlResource(Resource):
new_desc = new_desc[:MAX_SIZE] new_desc = new_desc[:MAX_SIZE]
# We always add an ellipsis because at the very least # We always add an ellipsis because at the very least
# we chooped mid paragraph. # we chopped mid paragraph.
description = new_desc.strip() + "" description = new_desc.strip() + ""
og['og:description'] = description if description else None og['og:description'] = description if description else None