atom feed: add link, move content order to bottom
NOTE: using relative links violates the Atom specification, but relative links are convenient aswell.
1 files changed, 11 insertions(+), 7 deletions(-) | |||
---|---|---|---|
M | stagit.c | +11 | -7 |
1@@ -507,6 +507,16 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
2 xmlencode(fp, ci->summary, strlen(ci->summary));
3 fputs("</title>\n", fp);
4 }
5+ fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"commit/%s.html\" />",
6+ ci->oid);
7+
8+ if (ci->author) {
9+ fputs("<author><name>", fp);
10+ xmlencode(fp, ci->author->name, strlen(ci->author->name));
11+ fputs("</name>\n<email>", fp);
12+ xmlencode(fp, ci->author->email, strlen(ci->author->email));
13+ fputs("</email>\n</author>\n", fp);
14+ }
15
16 fputs("<content type=\"text\">", fp);
17 fprintf(fp, "commit %s\n", ci->oid);
18@@ -526,13 +536,7 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
19 xmlencode(fp, ci->msg, strlen(ci->msg));
20 }
21 fputs("\n</content>\n", fp);
22- if (ci->author) {
23- fputs("<author><name>", fp);
24- xmlencode(fp, ci->author->name, strlen(ci->author->name));
25- fputs("</name>\n<email>", fp);
26- xmlencode(fp, ci->author->email, strlen(ci->author->email));
27- fputs("</email>\n</author>\n", fp);
28- }
29+
30 fputs("</entry>\n", fp);
31 }
32