# Best results with "git log -p --pretty=medium --date=rfc -C --find-hopies-harder" BEGIN { var_blog_title = "PyroPeters Blog"; var_blog_link = "http://keks.selfip.org/blog"; var_blog_description = "A very cool blog!!!1!111!!1"; var_blog_feed = var_blog_link "/feed.rss"; var_encoding = "UTF-8"; var_maxtitlelenght = 100; var_debug = 0; default_title = "-no title-"; default_link = var_blog_link; default_description = "foo"; write_header(); } END { item_done(); write_footer(); } // { if (var_debug == 1) { print "DEBUG:",$0; } } function replace_xml(text) { #gsub("&", "\\&", text); #gsub("<", "\\<", text); #gsub(">", "\\>", text); #gsub(" ", "\xAD", text); #gsub("", "\\&;", text); return ""; #TODO #return text; } function write_header() { print ""; print ""; print ""; print "" var_blog_title ""; } function write_footer() { print "" } function write_item () { print ""; if (item_title != "") { print "" item_title ""; } else { print "" default_title "<title>"; } if (item_link != "") { print "<link>" item_link "</link>"; } else { print "<link>" default_link "</link>"; } if (item_pubdate != "") { print "<pubDate>" item_pubdate "</pubDate>"; } if (item_description != "") { #print "<description>" replace_xml(item_description) "</description>"; #print "<description><![CDATA[" item_description "]]></description>"; print "<description>" item_description "</description>"; } else { print "<description>" default_description "</description>"; } print "</item>"; } function item_done () { if (item_description != "" && diff_destpath ~ "^/entrys/") { item_link = var_blog_link diff_destpath; item_rellink = substr(diff_destpath, 2); write_item(); } item_title = ""; item_guid = ""; item_link = ""; item_description = ""; item_pubdate = ""; diff_header = ""; diff_destpath = ""; #item_ = ""; } /^commit/ { if (NR != 1) { item_done(); } item_guid = $2; diff_mode = 0; } /^Date/ { item_pubdate = substr($0, 9); } /^ / { if (item_title == "") { item_title = substr($0, 5, var_maxtitlelenght); } } /^diff/ { diff_mode = 1; } /^[^+\-]/ { if (diff_mode == 1) { diff_header = item_diffheader "\n" $0; } } /^+++/ { if (diff_mode == 1) { if (substr($0,6) ~ "^/entrys/") { if (diff_destpath == "") { diff_destpath = substr($0,6); } } else { diff_mode = 0; } } } /^@@/ { if (diff_mode == 1) { diff_mode = 2; } } /^[+\- ]/ { if (diff_mode == 2) { #item_description = item_description ORS $0; item_description = item_description ORS "<change type=\"" ( $0 ~ "^+" ? "add" : ( $0 ~ "^-" ? "del" : "none" ) ) "\">" replace_xml(substr($0, 2)) "</change>"; } }