36 public $insClass =
' class="diffchange diffchange-inline"';
38 public $delClass =
' class="diffchange diffchange-inline"';
52 private function flushGroup( $new_tag ) {
53 if ( $this->group !==
'' ) {
54 $encGroup = htmlspecialchars( $this->group, ENT_NOQUOTES );
55 if ( $this->tag ==
'ins' ) {
56 $this->line .=
"<ins{$this->insClass}>$encGroup</ins>";
57 } elseif ( $this->tag ==
'del' ) {
58 $this->line .=
"<del{$this->delClass}>$encGroup</del>";
60 $this->line .= $encGroup;
64 $this->tag = $new_tag;
70 private function flushLine( $new_tag ) {
71 $this->flushGroup( $new_tag );
72 if ( $this->line !=
'' ) {
73 array_push( $this->lines, $this->line );
75 # make empty lines visible by inserting an NBSP
76 array_push( $this->lines,
"\u{00A0}" );
85 public function addWords( $words, $tag =
'' ) {
86 if ( $tag != $this->tag ) {
87 $this->flushGroup( $tag );
90 foreach ( $words as $word ) {
95 if ( $word[0] ==
"\n" ) {
96 $this->flushLine( $tag );
97 $word = substr( $word, 1 );
101 assert( !strstr( $word,
"\n" ) );
102 $this->group .= $word;
110 $this->flushLine(
'~done' );