summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-02-23 20:44:00 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-02-23 20:44:00 +0100
commit8bf328befabb4d95fa7bf8036f6309e4cd26570d (patch)
tree8c4dcdd605a27e8119020a802eedf4d0729fd4c3
parent5578784dda58fd79556bdc937e64f179d7ce5ea9 (diff)
atom feed: add link, move content order to bottom
NOTE: using relative links violates the Atom specification, but relative links are convenient aswell.
-rw-r--r--stagit.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/stagit.c b/stagit.c
index fd9e937..c22cc17 100644
--- a/stagit.c
+++ b/stagit.c
@@ -507,6 +507,16 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
xmlencode(fp, ci->summary, strlen(ci->summary));
fputs("</title>\n", fp);
}
+ fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"commit/%s.html\" />",
+ ci->oid);
+
+ if (ci->author) {
+ fputs("<author><name>", fp);
+ xmlencode(fp, ci->author->name, strlen(ci->author->name));
+ fputs("</name>\n<email>", fp);
+ xmlencode(fp, ci->author->email, strlen(ci->author->email));
+ fputs("</email>\n</author>\n", fp);
+ }
fputs("<content type=\"text\">", fp);
fprintf(fp, "commit %s\n", ci->oid);
@@ -526,13 +536,7 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
xmlencode(fp, ci->msg, strlen(ci->msg));
}
fputs("\n</content>\n", fp);
- if (ci->author) {
- fputs("<author><name>", fp);
- xmlencode(fp, ci->author->name, strlen(ci->author->name));
- fputs("</name>\n<email>", fp);
- xmlencode(fp, ci->author->email, strlen(ci->author->email));
- fputs("</email>\n</author>\n", fp);
- }
+
fputs("</entry>\n", fp);
}