From c66087838886d5921ffd8b5b1e57e0a09528e4b8 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Sun, 27 Aug 2017 00:04:21 +0200 Subject: better entry txt export using html2text --- src/Wallabag/CoreBundle/Helper/EntriesExport.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index de259e7f..838b9734 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -2,6 +2,7 @@ namespace Wallabag\CoreBundle\Helper; +use Html2Text\Html2Text; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerBuilder; use PHPePub\Core\EPub; @@ -408,7 +409,8 @@ class EntriesExport $bar = str_repeat('=', 100); foreach ($this->entries as $entry) { $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; - $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent()))) . "\n\n"; + $html = new Html2Text($entry->getContent(), ['do_links' => 'none', 'width' => 100]); + $content .= $html->getText(); } return Response::create( -- cgit v1.2.3