1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-27 17:28:39 +00:00

Merge pull request #3332 from nclsHart/better-txt-export

Better entry txt export using html2text
This commit is contained in:
Nicolas Lœuillet 2017-09-06 15:08:12 +02:00 committed by GitHub
commit 78b36d4dbe
2 changed files with 5 additions and 2 deletions

View file

@ -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(