Merge pull request #42 from Kdecherf/fix-tidy

tidy: use tidy_repair_string instead of tidy_parse_string+tidy_clean_repair
pull/45/head
Jérémy Benoist 7 years ago committed by GitHub
commit 49ce4233fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Readability.php

@ -274,10 +274,10 @@ class Readability implements LoggerAwareInterface
if ($this->useTidy) {
$this->logger->debug('Tidying document');
$tidy = tidy_parse_string($this->html, $this->tidy_config, 'UTF8');
if (tidy_clean_repair($tidy)) {
$tidy = tidy_repair_string($this->html, $this->tidy_config, 'UTF8');
if (false !== $tidy && $this->html !== $tidy) {
$this->tidied = true;
$this->html = $tidy->value;
$this->html = $tidy;
$this->html = preg_replace('/[\r\n]+/is', "\n", $this->html);
}
unset($tidy);

Loading…
Cancel
Save