D113: gitweb: preserve whitespace in description

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Jul 17 22:55:49 UTC 2017


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D113

AFFECTED FILES
  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

CHANGE DETAILS

diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -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 */
diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -175,6 +175,7 @@
 
 .description {
     font-family: monospace;
+    white-space: pre;
 }
 
 /* Followlines */
diff --git a/mercurial/templates/gitweb/filerevision.tmpl b/mercurial/templates/gitweb/filerevision.tmpl
--- a/mercurial/templates/gitweb/filerevision.tmpl
+++ b/mercurial/templates/gitweb/filerevision.tmpl
@@ -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"
diff --git a/mercurial/templates/gitweb/fileannotate.tmpl b/mercurial/templates/gitweb/fileannotate.tmpl
--- a/mercurial/templates/gitweb/fileannotate.tmpl
+++ b/mercurial/templates/gitweb/fileannotate.tmpl
@@ -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"
diff --git a/mercurial/templates/gitweb/changeset.tmpl b/mercurial/templates/gitweb/changeset.tmpl
--- a/mercurial/templates/gitweb/changeset.tmpl
+++ b/mercurial/templates/gitweb/changeset.tmpl
@@ -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">
diff --git a/mercurial/templates/gitweb/changelogentry.tmpl b/mercurial/templates/gitweb/changelogentry.tmpl
--- a/mercurial/templates/gitweb/changelogentry.tmpl
+++ b/mercurial/templates/gitweb/changelogentry.tmpl
@@ -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>



EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list