Created: 2023-06-05T01:13:25-05:00
Stanza to run everything:
git log --format="commit %H%nAuthor: %an%nSubject: %s%nDate: %aI%n%n%B" | gawk -f xml.awk | xmllint --format - > atom.xml
xml.awk:
# script to parse the output of git log --name-status BEGIN{ RS="commit "; FS="\n"; print "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; print "<feed xmlns=\"http://www.w3.org/2005/Atom\">"; print "<title>Example Feed</title>"; print "<subtitle>A subtitle.</subtitle>"; print "<link href=\"http://example.org/feed/\" rel=\"self\" />"; print "<link href=\"http://example.org/\" />"; print "<id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>"; PrintedUpdateStamp=0; } NR>1{ StartComment=0; CommentText = ""; CommitText = ""; SubjectText = ""; AuthorText = ""; DateText = ""; ChangesText = ""; isLast = 0; for(i = 1; i <= NF; i++) { if (i==1) {CommitText = $i;} if (match($i,/^Author/)) { # remove "author :" split($i,author1,": "); split(author1[2],author2," <") AuthorText = author2[1]; } else if (match($i, /^Subject/)) { # remove "subject :" split($i,dt,": "); for (j = 2; j <= length(dt); j++) { if (j > 2) SubjectText = SubjectText": "; SubjectText = SubjectText""dt[j]; } } else if (match($i,/^Date/)) { StartComment=1; ln=i; #remove "date :" split($i,dt,": "); DateText = dt[2]; #trim whitespaces gsub(/^[ \t]+/,"",DateText); } else if (StartComment==1 && i>ln) { {CommentText=CommentText$i"\n"} } } # steal the date from the most recent article # XXX should rip it from the current date, though... if (PrintedUpdateStamp==0) { print "<updated>"DateText"</updated>"; PrintedUpdateStamp=1; } print "\t<entry>"; print "\t\t<id>git:sha1:"CommitText"</id>"; print "\t\t<author><name>"AuthorText"</name></author>"; print "\t\t<title>"SubjectText"</title>"; print "\t\t<updated>"DateText"</updated>"; print "\t\t<content type=\"xhtml\">"; { cmd="multimarkdown -s --notransclude"; print CommentText |& cmd; close(cmd, "to"); while ((cmd |& getline line) > 0) { print line; } close(cmd); } #print CommentText; print "\t\t</content>"; print "\t</entry>"; } END { print "</feed>" }