mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 03:21:01 +00:00
Merge pull request #3332 from nclsHart/better-txt-export
Better entry txt export using html2text
This commit is contained in:
commit
78b36d4dbe
2 changed files with 5 additions and 2 deletions
|
@ -84,7 +84,8 @@
|
|||
"symfony/dom-crawler": "^3.1",
|
||||
"friendsofsymfony/jsrouting-bundle": "^1.6",
|
||||
"bdunogier/guzzle-site-authenticator": "^1.0.0@dev",
|
||||
"defuse/php-encryption": "^2.1"
|
||||
"defuse/php-encryption": "^2.1",
|
||||
"html2text/html2text": "^4.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/doctrine-fixtures-bundle": "~2.2",
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue