about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-01-01 09:25:01 +0000
committerEric Wong <e@80x24.org>2021-03-19 20:10:31 +0000
commit94cf57d94d841f535066bb279b46930bf134674b (patch)
tree7fcd374c5eb068cbbd4525105f84a28b25f7c0aa
parent56a88440fbc8a7338bcc01f6e0604b074bfac440 (diff)
downloadcgit-94cf57d94d841f535066bb279b46930bf134674b.tar.gz
ui-{commit,tag}: use <pre> for commit-msg
This preserves formatting readable for users of text-based browsers
without CSS support.

Signed-off-by: Eric Wong <e@80x24.org>
-rw-r--r--cgit.css5
-rwxr-xr-xtests/t0105-commit.sh2
-rw-r--r--ui-commit.c4
-rw-r--r--ui-tag.c4
4 files changed, 5 insertions, 10 deletions
diff --git a/cgit.css b/cgit.css
index a75f48b..f9549a1 100644
--- a/cgit.css
+++ b/cgit.css
@@ -436,11 +436,6 @@ div#cgit div.commit-subject {
         padding: 0em;
 }
 
-div#cgit div.commit-msg {
-        white-space: pre;
-        font-family: monospace;
-}
-
 div#cgit div.notes-header {
         font-weight: bold;
         padding-top: 1.5em;
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 1a12ee3..3bd4466 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -11,7 +11,7 @@ test_expect_success 'find commit subject' '
         grep "<div class=.commit-subject.>commit 5<" tmp
 '
 
-test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp'
+test_expect_success 'find commit msg' 'grep "<pre class=.commit-msg.></pre>" tmp'
 test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp'
 
 test_expect_success 'find diff summary' '
diff --git a/ui-commit.c b/ui-commit.c
index 948118c..14d1456 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -120,11 +120,11 @@ void cgit_print_commit(char *hex, const char *prefix)
         cgit_close_filter(ctx.repo->commit_filter);
         show_commit_decorations(commit);
         html("</div>");
-        html("<div class='commit-msg'>");
+        html("<pre class='commit-msg'>");
         cgit_open_filter(ctx.repo->commit_filter);
         html_txt(info->msg);
         cgit_close_filter(ctx.repo->commit_filter);
-        html("</div>");
+        html("</pre>");
         if (notes.len != 0) {
                 html("<div class='notes-header'>Notes</div>");
                 html("<div class='notes'>");
diff --git a/ui-tag.c b/ui-tag.c
index 424bbcc..0595242 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -25,9 +25,9 @@ static void print_tag_content(char *buf)
         html_txt(buf);
         html("</div>");
         if (p) {
-                html("<div class='commit-msg'>");
+                html("<pre class='commit-msg'>");
                 html_txt(++p);
-                html("</div>");
+                html("</pre>");
         }
 }