[DOC-WEB] [web-doc] master: a little more visual diff

1 view
Skip to first unread message

Nilgün Belma Bugüner

unread,
Dec 28, 2021, 9:10:29 AM12/28/21
to doc...@lists.php.net
Author: Nilgün Belma Bugüner (nilgun)
Date: 2021-12-28T17:10:19+03:00

Commit: https://github.com/php/web-doc/commit/d605eea3af354535e89f4eb6b08816b8db7218d6
Raw diff: https://github.com/php/web-doc/commit/d605eea3af354535e89f4eb6b08816b8db7218d6.diff

a little more visual diff

Changed paths:
M include/lib_revcheck.inc.php


Diff:

diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 7491f1e..08b6bd0 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -253,12 +253,12 @@ function showdiff ()
$file = `git diff {$arg_h} -- {$arg_f}`;
chdir( $cwd );
$raw = htmlspecialchars( $file, ENT_XML1, 'UTF-8' );
- if ( $c == 'on' ) {
- $trans = [ " " => " " ];
- $lines = explode ( "\n" , $raw );
- foreach ( $lines as $line ) {
- $inline = strtr( $line , $trans );
- $fc = substr( $inline , 0 , 1 );
+ $trans = [ " " => " " ];
+ $lines = explode ( "\n" , $raw );
+ foreach ( $lines as $line ) {
+ $inline = strtr( $line , $trans );
+ $fc = substr( $inline , 0 , 1 );
+ if ( $c == 'on' ) {
if ( $fc == "+" ) {
echo "<div style='color:darkgreen;background-color:#e6ffec;font-family:mono;overflow-wrap:break-word;'>";
} elseif ( $fc == "-" ) {
@@ -266,13 +266,16 @@ function showdiff ()
} elseif ( $fc == "@" ) {
echo "<div style='color:darkblue;background-color:#ddf4ff;font-family:mono;overflow-wrap:break-word;'>";
} else
- echo "<div style='color:gray;line-height:1.2;font-family:mono'>";
+ echo "<div style='color:gray;line-height:1.2;font-family:mono;overflow-wrap:break-word;'>";
echo "$inline</div>\n";
- }
- echo "<p></p>";
- } else
- echo "<pre style='font-family:mono'>" , $raw , "</pre>";
- }
+ } else
+ if ( ($fc == "+") || ($fc == "-") || ($fc == "@"))
+ echo "<div style='background-color:#f0f0f0;font-family:mono;overflow-wrap:break-word;'>$inline</div>\n";
+ else
+ echo "<div style='color:gray;font-family:mono;line-height:1.2;overflow-wrap:break-word;'>$inline</div>\n";
+ }
+ echo "<p></p>";
+ }
}

function gen_date($file)

--
Documentation Website Mailing List (http://doc.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply all
Reply to author
Forward
0 new messages