about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cgit.css2
-rw-r--r--cgit.h1
-rw-r--r--html.c28
-rw-r--r--ui-log.c4
-rw-r--r--ui-summary.c4
5 files changed, 34 insertions, 5 deletions
diff --git a/cgit.css b/cgit.css index 7b8e468..85815c1 100644 --- a/cgit.css +++ b/cgit.css
@@ -100,7 +100,7 @@ td.blob {
100 background-color: white; 100 background-color: white;
101} 101}
102 102
103table.log td { 103table.nowrap td {
104 white-space: nowrap; 104 white-space: nowrap;
105} 105}
106 106
diff --git a/cgit.h b/cgit.h index bba2d6c..362b435 100644 --- a/cgit.h +++ b/cgit.h
@@ -73,6 +73,7 @@ extern char *fmt(const char *format,...);
73extern void html(const char *txt); 73extern void html(const char *txt);
74extern void htmlf(const char *format,...); 74extern void htmlf(const char *format,...);
75extern void html_txt(char *txt); 75extern void html_txt(char *txt);
76extern void html_ntxt(int len, char *txt);
76extern void html_attr(char *txt); 77extern void html_attr(char *txt);
77extern void html_link_open(char *url, char *title, char *class); 78extern void html_link_open(char *url, char *title, char *class);
78extern void html_link_close(void); 79extern void html_link_close(void);
diff --git a/html.c b/html.c index 8a69659..957b326 100644 --- a/html.c +++ b/html.c
@@ -65,6 +65,34 @@ void html_txt(char *txt)
65 html(txt); 65 html(txt);
66} 66}
67 67
68void 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("&gt;");
79 else if (c=='<')
80 html("&lt;");
81 else if (c=='&')
82 html("&amp;");
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
69void html_attr(char *txt) 97void html_attr(char *txt)
70{ 98{
diff --git a/ui-log.c b/ui-log.c index def96f6..f3b16e7 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -23,7 +23,7 @@ void print_commit(struct commit *commit)
23 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); 23 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
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>");
29 html_txt(info->author); 29 html_txt(info->author);
@@ -48,7 +48,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt)
48 prepare_revision_walk(&rev); 48 prepare_revision_walk(&rev);
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>"
54 "<th class='left'>Author</th></tr>\n"); 54 "<th class='left'>Author</th></tr>\n");
diff --git a/ui-summary.c b/ui-summary.c index 638c8f6..de95053 100644 --- a/ui-summary.c +++ b/ui-summary.c
@@ -31,7 +31,7 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
31 url = cgit_pageurl(cgit_query_repo, "commit", 31 url = cgit_pageurl(cgit_query_repo, "commit",
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>");
37 html_txt(info->author); 37 html_txt(info->author);
@@ -49,7 +49,7 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
49 49
50static void cgit_print_branches() 50static 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>"
55 "<th class='left'>Commit subject</th>" 55 "<th class='left'>Commit subject</th>"