Commit 1bae08ad authored by birk's avatar birk
Browse files

truncate long texts and remove double linebreaks

parent f7dddae9
import textwrap
from system.config import Config
......@@ -45,8 +47,14 @@ class ApiData():
value = self.get_meta_datum(key)
if value:
if type(value) == str:
# remove double linebreaks
value = value.replace('\r', '\n')
while value.find('\n\n') > -1:
value = value.replace('\n\n', '\n')
if paragraph_separator_:
value = value.replace('\n', paragraph_separator_)
# shorten text
value = textwrap.shorten(value, 500, placeholder='...')
return separator_.join(values)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment