stagit

add titles to pages, summary for commit messages, filename for files

Hiltjo Posthuma contact@arjunchoudhary.com

commit: b03f03a parent: 7cad6ca
1 files changed, 9 insertions(+), 6 deletions(-)
Mstagit.c+9-6
M · stagit.c +9, -6
 1@@ -235,12 +235,15 @@ printtimeshort(FILE *fp, const git_time *intime)
 2 }
 3 
 4 int
 5-writeheader(FILE *fp)
 6+writeheader(FILE *fp, const char *title)
 7 {
 8 	fputs("<!DOCTYPE html>\n"
 9 		"<html dir=\"ltr\" lang=\"en\">\n<head>\n"
10 		"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
11 		"<meta http-equiv=\"Content-Language\" content=\"en\" />\n<title>", fp);
12+	xmlencode(fp, title, strlen(title));
13+	if (title[0] && stripped_name[0])
14+		fputs(" - ", fp);
15 	xmlencode(fp, stripped_name, strlen(stripped_name));
16 	if (description[0])
17 		fputs(" - ", fp);
18@@ -478,7 +481,7 @@ writelog(FILE *fp, const git_oid *oid)
19 		/* check if file exists if so skip it */
20 		if (access(path, F_OK)) {
21 			fpfile = efopen(path, "w");
22-			writeheader(fpfile);
23+			writeheader(fpfile, ci->summary);
24 			fputs("<pre>", fpfile);
25 			printshowfile(fpfile, ci);
26 			fputs("</pre>\n", fpfile);
27@@ -603,7 +606,7 @@ writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t fi
28 	relpath = tmp;
29 
30 	fp = efopen(fpath, "w");
31-	writeheader(fp);
32+	writeheader(fp, filename);
33 	fputs("<p> ", fp);
34 	xmlencode(fp, filename, strlen(filename));
35 	fprintf(fp, " (%juB)", (uintmax_t)filesize);
36@@ -961,7 +964,7 @@ main(int argc, char *argv[])
37 	/* log for HEAD */
38 	fp = efopen("log.html", "w");
39 	relpath = "";
40-	writeheader(fp);
41+	writeheader(fp, "Log");
42 	mkdir("commit", 0755);
43 	writelog(fp, head);
44 	writefooter(fp);
45@@ -969,14 +972,14 @@ main(int argc, char *argv[])
46 
47 	/* files for HEAD */
48 	fp = efopen("files.html", "w");
49-	writeheader(fp);
50+	writeheader(fp, "Files");
51 	writefiles(fp, head, "HEAD");
52 	writefooter(fp);
53 	fclose(fp);
54 
55 	/* summary page with branches and tags */
56 	fp = efopen("refs.html", "w");
57-	writeheader(fp);
58+	writeheader(fp, "Refs");
59 	writerefs(fp);
60 	writefooter(fp);
61 	fclose(fp);