changeset 5620:a02d87f66ce7

util/diff_html.py: Fixed whitespace in generated diff view table so white-space: pre can be used (and whitespace in diffs preserved).
author Eugene Syromyatnikov <evgsyr@gmail.com>
date Wed, 10 Mar 2010 04:14:15 +0300
parents 92e6d4ce7049
children 173c6612e240
files MoinMoin/util/diff_html.py MoinMoin/web/static/htdocs/classic/css/screen.css MoinMoin/web/static/htdocs/modern/css/screen.css MoinMoin/web/static/htdocs/modernized/css/screen.css MoinMoin/web/static/htdocs/rightsidebar/css/screen.css
diffstat 5 files changed, 40 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/diff_html.py	Tue Mar 09 18:06:25 2010 +0300
+++ b/MoinMoin/util/diff_html.py	Wed Mar 10 04:14:15 2010 +0300
@@ -60,16 +60,8 @@
     else:
         result += """
 <tr>
-<td class="diff-removed">
-<span>
-%s
-</span>
-</td>
-<td class="diff-added">
-<span>
-%s
-</span>
-</td>
+<td class="diff-removed"><span>%s</span></td>
+<td class="diff-added"><span>%s</span></td>
 </tr>
 """ % (_('Deletions are marked like this.'), _('Additions are marked like this.'), )
 
@@ -84,12 +76,8 @@
             llineno, rlineno = lastmatch[0]+1, lastmatch[1]+1
             result += """
 <tr class="diff-title">
-<td>
-%s:
-</td>
-<td>
-%s:
-</td>
+<td>%s:</td>
+<td>%s:</td>
 </tr>
 """ % (request.formatter.line_anchorlink(1, llineno) + request.formatter.text(t_line % llineno) + request.formatter.line_anchorlink(0),
            request.formatter.line_anchorlink(1, rlineno) + request.formatter.text(t_line % rlineno) + request.formatter.line_anchorlink(0))
@@ -138,18 +126,14 @@
                     rightresult += escape(rightpane[thismatch[1]:thismatch[1] + thismatch[2]])
                     charlast = (thismatch[0] + thismatch[2], thismatch[1] + thismatch[2])
 
-            leftpane = '<br>\n'.join([indent(x) for x in leftresult.splitlines()])
-            rightpane = '<br>\n'.join([indent(x) for x in rightresult.splitlines()])
+            leftpane = '<br>'.join([indent(x) for x in leftresult.splitlines()])
+            rightpane = '<br>'.join([indent(x) for x in rightresult.splitlines()])
 
             # removed width="50%%"
             result += """
 <tr>
-<td class="diff-removed">
-%s
-</td>
-<td class="diff-added">
-%s
-</td>
+<td class="diff-removed">%s</td>
+<td class="diff-added">%s</td>
 </tr>
 """ % (leftpane, rightpane)
 
--- a/MoinMoin/web/static/htdocs/classic/css/screen.css	Tue Mar 09 18:06:25 2010 +0300
+++ b/MoinMoin/web/static/htdocs/classic/css/screen.css	Wed Mar 10 04:14:15 2010 +0300
@@ -399,14 +399,20 @@
 
 .diff-added {
 	background-color: #E0FFE0;
-	vertical-align: sub;
+	vertical-align: top;
 	width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-removed {
 	background-color: #FFFFE0;
-	vertical-align: sub;
+	vertical-align: top;
 	width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-added span {
--- a/MoinMoin/web/static/htdocs/modern/css/screen.css	Tue Mar 09 18:06:25 2010 +0300
+++ b/MoinMoin/web/static/htdocs/modern/css/screen.css	Wed Mar 10 04:14:15 2010 +0300
@@ -459,14 +459,20 @@
 
 .diff-added {
     background-color: #E0FFE0;
-    vertical-align: sub;
+    vertical-align: top;
     width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-removed {
     background-color: #FFFFE0;
-    vertical-align: sub;
+    vertical-align: top;
     width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-added span {
--- a/MoinMoin/web/static/htdocs/modernized/css/screen.css	Tue Mar 09 18:06:25 2010 +0300
+++ b/MoinMoin/web/static/htdocs/modernized/css/screen.css	Wed Mar 10 04:14:15 2010 +0300
@@ -415,14 +415,20 @@
 
 .diff-added {
     background-color: #E0FFE0;
-    vertical-align: sub;
+    vertical-align: top;
     width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-removed {
     background-color: #FFFFE0;
-    vertical-align: sub;
+    vertical-align: top;
     width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-added span {
--- a/MoinMoin/web/static/htdocs/rightsidebar/css/screen.css	Tue Mar 09 18:06:25 2010 +0300
+++ b/MoinMoin/web/static/htdocs/rightsidebar/css/screen.css	Wed Mar 10 04:14:15 2010 +0300
@@ -350,14 +350,20 @@
 
 .diff-added {
 	background-color: #E0FFE0;
-	vertical-align: sub;
+	vertical-align: top;
 	width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-removed {
 	background-color: #FFFFE0;
-	vertical-align: sub;
+	vertical-align: top;
 	width: 50%;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font-family: courier, monospace;
 }
 
 .diff-added span {