From 58c9653c6b7f258ed24fe509e2db1664d90ae866 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 2 Aug 2016 18:50:03 +0100 Subject: Don't infer paragrahs from newlines --- synapse/rest/media/v1/preview_url_resource.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'synapse/rest/media') diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py index 64ad218f70..ebd07d696b 100644 --- a/synapse/rest/media/v1/preview_url_resource.py +++ b/synapse/rest/media/v1/preview_url_resource.py @@ -344,9 +344,8 @@ class PreviewUrlResource(Resource): # Split all the text nodes into paragraphs (by splitting on new # lines) text_nodes = ( - line.strip() + re.sub(r'\s+', '\n', el.text).strip() for el in cloned_tree.iter() if el.text - for line in el.text.splitlines() ) # Try to get a summary of between 200 and 500 words, respecting -- cgit 1.4.1