]> git.armaanb.net Git - stagit.git/commitdiff
atom feed: add link, move content order to bottom
authorHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 23 Feb 2016 19:44:00 +0000 (20:44 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 23 Feb 2016 19:44:00 +0000 (20:44 +0100)
NOTE: using relative links violates the Atom specification, but relative
links are convenient aswell.

stagit.c

index fd9e9379bfe67f88afdcabe3df1568f8fefe47d5..c22cc17f98df67f974fc29c2f68186e635af4271 100644 (file)
--- 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);
 }