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:
parent
cf05a1ae34
commit
0d6cfb884c
3 changed files with 14 additions and 32 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue