/** * Return the difference between two HTML documents. * @param String $a The first HTML document * @param String $b The second HTML document * @param Boolean $describe_formatting_changes If true, changes in the formatting (for example adding a certain HTML attribute * to a tag) are shown in text form. * @return String An HTML document that represents the difference between the two HTML documents by assigning the class names * diff-html-added and diff-html-removed to the changed elements. */ function html_diff($a, $b, $describe_formatting_changes = false) { $out = new ChangeText(); $htmldiffer = new HTMLDiffer(new DelegatingContentHandler($out)); $htmldiffer->htmlDiff($a, $b, $describe_formatting_changes); return $out->toString(); }
protected function addAttributes(ChangeText $txt, array $attributes) { if (array_key_exists('href', $attributes)) { $txt->addHtml(' with destination ' . htmlspecialchars($attributes['href'])); unset($attributes['href']); } parent::addAttributes($txt, $attributes); }
protected function addAttributes(ChangeText $txt, array $attributes) { if (array_key_exists('href', $attributes)) { $txt->addHtml(' ' . wfMsgExt('diff-withdestination', 'parseinline', htmlspecialchars($attributes['href']))); unset($attributes['href']); } parent::addAttributes($txt, $attributes); }