summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-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
@@ -102,3 +102,3 @@ td.blob {
102 102
103table.log td { 103table.nowrap td {
104 white-space: nowrap; 104 white-space: nowrap;
diff --git a/cgit.h b/cgit.h
index bba2d6c..362b435 100644
--- a/cgit.h
+++ b/cgit.h
@@ -75,2 +75,3 @@ extern 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);
diff --git a/html.c b/html.c
index 8a69659..957b326 100644
--- a/html.c
+++ b/html.c
@@ -67,2 +67,30 @@ void html_txt(char *txt)
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
diff --git a/ui-log.c b/ui-log.c
index def96f6..f3b16e7 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -25,3 +25,3 @@ void print_commit(struct commit *commit)
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();
@@ -50,3 +50,3 @@ void cgit_print_log(const char *tip, int ofs, int cnt)
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>"
diff --git a/ui-summary.c b/ui-summary.c
index 638c8f6..de95053 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -33,3 +33,3 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *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();
@@ -51,3 +51,3 @@ 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>"