gitweb: preserve whitespace in description
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 17 Jul 2017 15:54:15 -0700
changeset 33557 875b054e5b95
parent 33556 22371eabb3b1
child 33558 0103e7187237
gitweb: preserve whitespace in description Without this, multiple spaces or tabs in the commit message aren't preserved and things like tables don't align properly. As part of adding the CSS rule, we had to cuddle the content with the <div> to not introduce leading and trailing whitespace. The "addbreaks" filter was also removed because it would insert an additional newline, effectively double spacing content. Differential Revision: https://phab.mercurial-scm.org/D113
mercurial/templates/gitweb/changelogentry.tmpl
mercurial/templates/gitweb/changeset.tmpl
mercurial/templates/gitweb/fileannotate.tmpl
mercurial/templates/gitweb/filerevision.tmpl
mercurial/templates/static/style-gitweb.css
tests/test-hgweb.t
--- a/mercurial/templates/gitweb/changelogentry.tmpl	Mon Jul 17 11:45:38 2017 -0700
+++ b/mercurial/templates/gitweb/changelogentry.tmpl	Mon Jul 17 15:54:15 2017 -0700
@@ -7,8 +7,6 @@
 </div>
 <i>{author|obfuscate} [{date|rfc822date}] rev {rev}</i><br/>
 </div>
-<div class="log_body description">
-{desc|strip|escape|websub|addbreaks|nonempty}
-<br/>
-<br/>
+<div class="log_body description">{desc|strip|escape|websub|nonempty}
+
 </div>
--- a/mercurial/templates/gitweb/changeset.tmpl	Mon Jul 17 11:45:38 2017 -0700
+++ b/mercurial/templates/gitweb/changeset.tmpl	Mon Jul 17 15:54:15 2017 -0700
@@ -45,9 +45,7 @@
 {child%changesetchild}
 </table></div>
 
-<div class="page_body description">
-{desc|strip|escape|websub|addbreaks|nonempty}
-</div>
+<div class="page_body description">{desc|strip|escape|websub|nonempty}</div>
 <div class="list_head"></div>
 <div class="title_text">
 <table cellspacing="0">
--- a/mercurial/templates/gitweb/fileannotate.tmpl	Mon Jul 17 11:45:38 2017 -0700
+++ b/mercurial/templates/gitweb/fileannotate.tmpl	Mon Jul 17 15:54:15 2017 -0700
@@ -61,9 +61,7 @@
 </table>
 </div>
 
-<div class="page_path description">
-{desc|strip|escape|websub|addbreaks|nonempty}
-</div>
+<div class="page_path description">{desc|strip|escape|websub|nonempty}</div>
 <div class="page_body">
 <table>
 <tbody class="sourcelines"
--- a/mercurial/templates/gitweb/filerevision.tmpl	Mon Jul 17 11:45:38 2017 -0700
+++ b/mercurial/templates/gitweb/filerevision.tmpl	Mon Jul 17 15:54:15 2017 -0700
@@ -61,9 +61,7 @@
 </table>
 </div>
 
-<div class="page_path description">
-{desc|strip|escape|websub|addbreaks|nonempty}
-</div>
+<div class="page_path description">{desc|strip|escape|websub|nonempty}</div>
 
 <div class="page_body">
 <pre class="sourcelines stripes"
--- a/mercurial/templates/static/style-gitweb.css	Mon Jul 17 11:45:38 2017 -0700
+++ b/mercurial/templates/static/style-gitweb.css	Mon Jul 17 15:54:15 2017 -0700
@@ -175,6 +175,7 @@
 
 .description {
     font-family: monospace;
+    white-space: pre;
 }
 
 /* Followlines */
--- a/tests/test-hgweb.t	Mon Jul 17 11:45:38 2017 -0700
+++ b/tests/test-hgweb.t	Mon Jul 17 15:54:15 2017 -0700
@@ -340,7 +340,7 @@
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 8985
+  content-length: 9007
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -520,6 +520,7 @@
   
   .description {
       font-family: monospace;
+      white-space: pre;
   }
   
   /* Followlines */