Make WordPress Core

Ticket #25473: 25473.4.diff

File 25473.4.diff, 4.0 KB (added by joedolson, 4 years ago)

Streamlined patch to handle functional differences

  • src/wp-admin/includes/revision.php

     
    8686
    8787                $args = array(
    8888                        'show_split_view' => true,
     89                        'title_left'      => __( 'Removed' ),
     90                        'title_right'     => __( 'Added' ),
    8991                );
    9092
    9193                /**
  • src/wp-includes/class-wp-text-diff-renderer-table.php

     
    176176                        }
    177177
    178178                        if ( $this->_show_split_view ) {
    179                                 $r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
     179                                $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
    180180                        } else {
    181181                                $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
    182182                        }
     
    201201                                $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
    202202                        }
    203203                        if ( $this->_show_split_view ) {
    204                                 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n";
     204                                $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
    205205                        } else {
    206206                                $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
    207207                        }
     
    226226                                $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
    227227                        }
    228228                        if ( $this->_show_split_view ) {
    229                                 $r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line ) . "</tr>\n";
     229                                $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
    230230                        } else {
    231231                                $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
    232232                        }
     
    319319                                $r .= $this->_deleted( array( $orig_line ), false );
    320320                        } else { // A true changed row.
    321321                                if ( $this->_show_split_view ) {
    322                                         $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->emptyLine() . $this->addedLine( $final_line ) . "</tr>\n";
     322                                        $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n";
    323323                                } else {
    324324                                        $r .= '<tr>' . $this->deletedLine( $orig_line ) . '</tr><tr>' . $this->addedLine( $final_line ) . "</tr>\n";
    325325                                }
  • src/wp-includes/pluggable.php

     
    28382838                        return '';
    28392839                }
    28402840
    2841                 $r = "<table class='diff'>\n";
     2841                $is_split_view       = ! empty( $args['show_split_view'] );
     2842                $is_split_view_class = $is_split_view ? ' is-split-view' : '';
    28422843
    2843                 if ( ! empty( $args['show_split_view'] ) ) {
    2844                         $r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />";
    2845                 } else {
    2846                         $r .= "<col class='content' />";
     2844                $r = "<table class='diff$is_split_view_class'>\n";
     2845
     2846                if ( $args['title'] ) {
     2847                        $r .= "<caption class='diff-title'>$args[title]</caption>\n";
    28472848                }
    28482849
    2849                 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
     2850                if ( $args['title_left'] || $args['title_right'] ) {
    28502851                        $r .= '<thead>';
    28512852                }
    2852                 if ( $args['title'] ) {
    2853                         $r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
    2854                 }
     2853
    28552854                if ( $args['title_left'] || $args['title_right'] ) {
     2855                        $th_or_td_left  = empty( $args['title_left'] ) ? 'td' : 'th';
     2856                        $th_or_td_right = empty( $args['title_right'] ) ? 'td' : 'th';
     2857
    28562858                        $r .= "<tr class='diff-sub-title'>\n";
    2857                         $r .= "\t<td></td><th>$args[title_left]</th>\n";
    2858                         $r .= "\t<td></td><th>$args[title_right]</th>\n";
     2859                        $r .= "\t<$th_or_td_left>$args[title_left]</$th_or_td_left>\n";
     2860                        if ( $is_split_view ) {
     2861                                $r .= "\t<$th_or_td_right>$args[title_right]</$th_or_td_right>\n";
     2862                        }
    28592863                        $r .= "</tr>\n";
    28602864                }
    2861                 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
     2865
     2866                if ( $args['title_left'] || $args['title_right'] ) {
    28622867                        $r .= "</thead>\n";
    28632868                }
    28642869