diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2012-01-30 17:41:35 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:19 +0000 |
commit | 2b4f40e85691650d79e14a5a0884853de52d68fa (patch) | |
tree | 701beb89c6b0c96ff5eb8f7aebc4cb107e7ff6f5 | |
parent | e353d65dbbf2784a2eaa59890b0187925288651c (diff) |
Improve the html output of the changelog generator.
There were some compatibility problems with the html from the git log to
html changelog generator - such as including '<' and '>' characters in
text to be displayed.
Also, improve the actual formatting slightly.
CLUSTER_UNTESTED
-rwxr-xr-x | gs/toolbin/gitlog2changelog.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gs/toolbin/gitlog2changelog.py b/gs/toolbin/gitlog2changelog.py index a20a86175..a3dc5ce6a 100755 --- a/gs/toolbin/gitlog2changelog.py +++ b/gs/toolbin/gitlog2changelog.py @@ -16,6 +16,7 @@ import sys import string import datetime import time +import codecs argc = len(sys.argv) if argc < 3: @@ -52,7 +53,7 @@ else: res = os.popen(cmd, "r") commit=res.readlines() # This assumes the order of the lines..... - sys.stdout.write("<p><strong><a name=") + sys.stdout.write("<p><strong>") if str.find(commit[1], "Merge:") < 0: nm = commit[1] dt = commit[2] @@ -63,21 +64,28 @@ else: logidx = 4 sys.stdout.write (dt.split("Date:")[1].strip()) - sys.stdout.write ("></a>\n") - sys.stdout.write (dt.split("Date:")[1].strip()) - sys.stdout.write ("</strong>\n<br>" + nm.split("Author: ")[1].strip() + "<br>\n") + sys.stdout.write ("\n") + auth_name=nm.split("Author: ")[1].strip() + sys.stdout.write ("</strong>\n<br>" + auth_name.replace("<", "<").replace(">", ">") + "<br>\n") sys.stdout.write ("<a href=\"http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=" + commit[0].split("commit ")[1].strip() + "\">") sys.stdout.write (commit[0].split("commit ")[1].strip() + "</a>\n") sys.stdout.write ("<blockquote>\n") + sys.stdout.write ("<p>\n") log = commit[logidx:] + marked = 0 + # this loop needs to skip initial blank lines for logline in log: - sys.stdout.write (logline + "<br>\n") + if len(logline.strip()) == 0 and marked == 0 : + continue + sys.stdout.write (logline.replace("<", "<").replace(">", ">") + "<br>\n") + marked = 1 sys.stdout.write ("<p>\n") sys.stdout.write ("</blockquote>\n") - sys.stdout.write ("<hb>\n") + sys.stdout.write ("<hr>\n") + sys.stdout.write ("<hr size=20>\n\n\n") sys.stdout.write ("</body>\n") sys.stdout.write ("</html>\n") |