1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

Remove htmlawed and use graby instead

Instead of using htmlawed (which is already used in graby) use graby directly (which require some refacto on graby side).
Still needs some tests.
This commit is contained in:
Jeremy Benoist 2017-05-16 23:11:20 +02:00
parent cf05a1ae34
commit 0d6cfb884c
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
3 changed files with 14 additions and 32 deletions

View file

@ -47,24 +47,7 @@ class ContentProxy
{
// ensure content is a bit cleaned up
if (!empty($content['html'])) {
$extractor = $this->graby->getExtractor();
$contentExtracted = $extractor->process($content['html'], $url);
if ($contentExtracted) {
$contentBlock = $extractor->getContent();
$contentBlock->normalize();
$content['html'] = trim($contentBlock->innerHTML);
}
$content['html'] = htmLawed($content['html'], [
'safe' => 1,
// which means: do not remove iframe elements
'elements' => '*+iframe',
'deny_attribute' => 'style',
'comment' => 1,
'cdata' => 1,
]);
$content['html'] = $this->graby->cleanupHtml($content['html'], $url);
}
// do we have to fetch the content or the provided one is ok?