Text_Diff_Renderer_inline example

preg_split('//', $text2)));
        } else {
            /* We want to split on word boundaries, but we need to preserve * whitespace as well. Therefore we split on words, but include * all blocks of whitespace in the wordlist. */
            $diff = new Text_Diff('native',
                                  array($this->_splitOnWords($text1$nl),
                                        $this->_splitOnWords($text2$nl)));
        }

        /* Get the diff in inline format. */
        $renderer = new Text_Diff_Renderer_inline
            (array_merge($this->getParams(),
                         array('split_level' => $this->_split_characters ? 'characters' : 'words')));

        /* Run the diff and get the output. */
        return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
    }

    function _splitOnWords($string$newlineEscape = "\n")
    {
        // Ignore \0; otherwise the while loop will never finish.         $string = str_replace("\0", '', $string);

        
Home | Imprint | This part of the site doesn't use cookies.