background-color: white;
}
-table.log td {
+table.nowrap td {
white-space: nowrap;
}
extern void html(const char *txt);
extern void htmlf(const char *format,...);
extern void html_txt(char *txt);
+extern void html_ntxt(int len, char *txt);
extern void html_attr(char *txt);
extern void html_link_open(char *url, char *title, char *class);
extern void html_link_close(void);
html(txt);
}
+void html_ntxt(int len, char *txt)
+{
+ char *t = txt;
+ while(*t && len--){
+ int c = *t;
+ if (c=='<' || c=='>' || c=='&') {
+ *t = '\0';
+ html(txt);
+ *t = c;
+ if (c=='>')
+ html(">");
+ else if (c=='<')
+ html("<");
+ else if (c=='&')
+ html("&");
+ txt = t+1;
+ }
+ t++;
+ }
+ if (t!=txt) {
+ char c = *t;
+ *t = '\0';
+ html(txt);
+ *t = c;
+ }
+ if (len<0)
+ html("...");
+}
void html_attr(char *txt)
{
char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
html_link_open(url, NULL, NULL);
- html_txt(info->subject);
+ html_ntxt(80, info->subject);
html_link_close();
html("</td><td>");
html_txt(info->author);
prepare_revision_walk(&rev);
html("<h2>Log</h2>");
- html("<table class='list log'>");
+ html("<table class='list nowrap'>");
html("<tr><th class='left'>Date</th>"
"<th class='left'>Message</th>"
"<th class='left'>Author</th></tr>\n");
url = cgit_pageurl(cgit_query_repo, "commit",
fmt("id=%s", sha1_to_hex(sha1)));
html_link_open(url, NULL, NULL);
- html_txt(info->subject);
+ html_ntxt(80, info->subject);
html_link_close();
html("</td><td>");
html_txt(info->author);
static void cgit_print_branches()
{
- html("<table class='list'>");
+ html("<table class='list nowrap'>");
html("<tr><th class='left'>Branch</th>"
"<th class='left'>Updated</th>"
"<th class='left'>Commit subject</th>"