author | Lars Hjemli <hjemli@gmail.com> | 2006-12-21 23:58:18 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-21 23:58:18 (UTC) |
commit | 9d8d9b61238df3a855504825e5f735d00289f12b (patch) (unidiff) | |
tree | ee4e5b6712abb684b920f1f69683eb2b43c6fd8d | |
parent | 378cae639849ba9f020666d1cf6dad6e08bfaf0e (diff) | |
download | cgit-9d8d9b61238df3a855504825e5f735d00289f12b.zip cgit-9d8d9b61238df3a855504825e5f735d00289f12b.tar.gz cgit-9d8d9b61238df3a855504825e5f735d00289f12b.tar.bz2 |
Only show first 80 characters of commit subject in log and summary
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.css | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | html.c | 28 | ||||
-rw-r--r-- | ui-log.c | 4 | ||||
-rw-r--r-- | ui-summary.c | 4 |
5 files changed, 34 insertions, 5 deletions
@@ -101,5 +101,5 @@ td.blob { | |||
101 | } | 101 | } |
102 | 102 | ||
103 | table.log td { | 103 | table.nowrap td { |
104 | white-space: nowrap; | 104 | white-space: nowrap; |
105 | } | 105 | } |
@@ -74,4 +74,5 @@ extern void html(const char *txt); | |||
74 | extern void htmlf(const char *format,...); | 74 | extern void htmlf(const char *format,...); |
75 | extern void html_txt(char *txt); | 75 | extern void html_txt(char *txt); |
76 | extern void html_ntxt(int len, char *txt); | ||
76 | extern void html_attr(char *txt); | 77 | extern void html_attr(char *txt); |
77 | extern void html_link_open(char *url, char *title, char *class); | 78 | extern void html_link_open(char *url, char *title, char *class); |
@@ -66,4 +66,32 @@ void html_txt(char *txt) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | void html_ntxt(int len, char *txt) | ||
69 | { | ||
70 | char *t = txt; | ||
71 | while(*t && len--){ | ||
72 | int c = *t; | ||
73 | if (c=='<' || c=='>' || c=='&') { | ||
74 | *t = '\0'; | ||
75 | html(txt); | ||
76 | *t = c; | ||
77 | if (c=='>') | ||
78 | html(">"); | ||
79 | else if (c=='<') | ||
80 | html("<"); | ||
81 | else if (c=='&') | ||
82 | html("&"); | ||
83 | txt = t+1; | ||
84 | } | ||
85 | t++; | ||
86 | } | ||
87 | if (t!=txt) { | ||
88 | char c = *t; | ||
89 | *t = '\0'; | ||
90 | html(txt); | ||
91 | *t = c; | ||
92 | } | ||
93 | if (len<0) | ||
94 | html("..."); | ||
95 | } | ||
68 | 96 | ||
69 | void html_attr(char *txt) | 97 | void html_attr(char *txt) |
@@ -24,5 +24,5 @@ void print_commit(struct commit *commit) | |||
24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); | 24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); |
25 | html_link_open(url, NULL, NULL); | 25 | html_link_open(url, NULL, NULL); |
26 | html_txt(info->subject); | 26 | html_ntxt(80, info->subject); |
27 | html_link_close(); | 27 | html_link_close(); |
28 | html("</td><td>"); | 28 | html("</td><td>"); |
@@ -49,5 +49,5 @@ void cgit_print_log(const char *tip, int ofs, int cnt) | |||
49 | 49 | ||
50 | html("<h2>Log</h2>"); | 50 | html("<h2>Log</h2>"); |
51 | html("<table class='list log'>"); | 51 | html("<table class='list nowrap'>"); |
52 | html("<tr><th class='left'>Date</th>" | 52 | html("<tr><th class='left'>Date</th>" |
53 | "<th class='left'>Message</th>" | 53 | "<th class='left'>Message</th>" |
diff --git a/ui-summary.c b/ui-summary.c index 638c8f6..de95053 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -32,5 +32,5 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
32 | fmt("id=%s", sha1_to_hex(sha1))); | 32 | fmt("id=%s", sha1_to_hex(sha1))); |
33 | html_link_open(url, NULL, NULL); | 33 | html_link_open(url, NULL, NULL); |
34 | html_txt(info->subject); | 34 | html_ntxt(80, info->subject); |
35 | html_link_close(); | 35 | html_link_close(); |
36 | html("</td><td>"); | 36 | html("</td><td>"); |
@@ -50,5 +50,5 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
50 | static void cgit_print_branches() | 50 | static void cgit_print_branches() |
51 | { | 51 | { |
52 | html("<table class='list'>"); | 52 | html("<table class='list nowrap'>"); |
53 | html("<tr><th class='left'>Branch</th>" | 53 | html("<tr><th class='left'>Branch</th>" |
54 | "<th class='left'>Updated</th>" | 54 | "<th class='left'>Updated</th>" |