diff options
author | Nicolas Hart <contact@nclshart.net> | 2017-08-27 00:04:21 +0200 |
---|---|---|
committer | Nicolas Hart <contact@nclshart.net> | 2017-08-27 00:04:21 +0200 |
commit | c66087838886d5921ffd8b5b1e57e0a09528e4b8 (patch) | |
tree | 7226b9753d42857fc73226ebf527b2e6b71f8316 /src | |
parent | 2490f61dca635026a3eb9b5e9b6978b1981b1172 (diff) | |
download | wallabag-c66087838886d5921ffd8b5b1e57e0a09528e4b8.tar.gz wallabag-c66087838886d5921ffd8b5b1e57e0a09528e4b8.tar.zst wallabag-c66087838886d5921ffd8b5b1e57e0a09528e4b8.zip |
better entry txt export using html2text
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Html2Text\Html2Text; | ||
5 | use JMS\Serializer\SerializationContext; | 6 | use JMS\Serializer\SerializationContext; |
6 | use JMS\Serializer\SerializerBuilder; | 7 | use JMS\Serializer\SerializerBuilder; |
7 | use PHPePub\Core\EPub; | 8 | use PHPePub\Core\EPub; |
@@ -408,7 +409,8 @@ class EntriesExport | |||
408 | $bar = str_repeat('=', 100); | 409 | $bar = str_repeat('=', 100); |
409 | foreach ($this->entries as $entry) { | 410 | foreach ($this->entries as $entry) { |
410 | $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; | 411 | $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; |
411 | $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent()))) . "\n\n"; | 412 | $html = new Html2Text($entry->getContent(), ['do_links' => 'none', 'width' => 100]); |
413 | $content .= $html->getText(); | ||
412 | } | 414 | } |
413 | 415 | ||
414 | return Response::create( | 416 | return Response::create( |