about summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2006-12-22 00:58:18 +0100
committerLars Hjemli <hjemli@gmail.com>2006-12-22 00:58:18 +0100
commit9d8d9b61238df3a855504825e5f735d00289f12b (patch)
treeee4e5b6712abb684b920f1f69683eb2b43c6fd8d /html.c
parentAdd missing ttl-options in config (diff)
downloadcgit-pink-9d8d9b61238df3a855504825e5f735d00289f12b.tar.gz
cgit-pink-9d8d9b61238df3a855504825e5f735d00289f12b.zip
Only show first 80 characters of commit subject in log and summary
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--html.c28
1 files changed, 28 insertions, 0 deletions
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)
 		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("&gt;");
+			else if (c=='<')
+				html("&lt;");
+			else if (c=='&')
+				html("&amp;");
+			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)
 {