diff options
author | Andrew Dolgov <[email protected]> | 2024-04-03 17:58:29 +0000 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2024-04-03 17:58:29 +0000 |
commit | f2169ca419be339fa5ba32d0a50770f3d442d8b7 (patch) | |
tree | 05d540d97ad9d1b3bdb65ddbe26c1410658b1b28 /vendor/fivefilters/readability.php/src/Readability.php | |
parent | cdc97d886cb7085f9c44a1796ee4bbbf57534d06 (diff) | |
parent | 9ba1adcde4953c8e04630b7b31c29b66d158d428 (diff) |
Merge branch 'feature/readability-ignore-more-elements' into 'master'
Have Readability ignore/strip 'template' elements.
See merge request tt-rss/plugins/ttrss-af-readability!1
Diffstat (limited to 'vendor/fivefilters/readability.php/src/Readability.php')
-rw-r--r-- | vendor/fivefilters/readability.php/src/Readability.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/fivefilters/readability.php/src/Readability.php b/vendor/fivefilters/readability.php/src/Readability.php index 6407a92..c5318a4 100644 --- a/vendor/fivefilters/readability.php/src/Readability.php +++ b/vendor/fivefilters/readability.php/src/Readability.php @@ -342,7 +342,7 @@ class Readability // Extract JSON-LD metadata before removing scripts $this->jsonld = $this->configuration->getDisableJSONLD() ? [] : $this->getJSONLD($dom); - $this->removeScripts($dom); + $this->removeIgnoredElements($dom); $this->prepDocument($dom); @@ -1188,13 +1188,13 @@ class Readability } /** - * Removes all the scripts of the html. + * Removes elements that should be ignored. * * @param DOMDocument $dom */ - private function removeScripts(DOMDocument $dom) + private function removeIgnoredElements(DOMDocument $dom) { - foreach (['script', 'noscript'] as $tag) { + foreach (['noscript', 'script', ...$this->configuration->getExtraIgnoredElements()] as $tag) { $nodes = $dom->getElementsByTagName($tag); foreach (iterator_to_array($nodes) as $node) { NodeUtility::removeNode($node); |