From 1405fbcc5862388b859d975ff7b8f95350d46240 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 19 Oct 2014 11:47:16 -0400 Subject: format_changelog.py: learn about the ReleaseNotes format --- scripts/maint/format_changelog.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py index f67e89b602..32a3d74e31 100755 --- a/scripts/maint/format_changelog.py +++ b/scripts/maint/format_changelog.py @@ -156,10 +156,13 @@ TP_SECHEAD = 3 TP_ITEMFIRST = 4 TP_ITEMBODY = 5 TP_END = 6 +TP_PREHEAD = 7 def head_parser(line): - if re.match(r'^[A-Z]', line): + if re.match(r'^Changes in', line): return TP_MAINHEAD + elif re.match(r'^[A-Za-z]', line): + return TP_PREHEAD elif re.match(r'^ o ', line): return TP_SECHEAD elif re.match(r'^\s*$', line): @@ -178,11 +181,14 @@ def body_parser(line): return TP_BLANK elif re.match(r'^Changes in', line): return TP_END + elif re.match(r'^\s+\S', line): + return TP_HEADTEXT else: print "Weird line %r"%line class ChangeLog(object): def __init__(self): + self.prehead = [] self.mainhead = None self.headtext = [] self.curgraf = None @@ -197,6 +203,9 @@ class ChangeLog(object): assert not self.mainhead self.mainhead = line + elif tp == TP_PREHEAD: + self.prehead.append(line) + elif tp == TP_HEADTEXT: if self.curgraf is None: self.curgraf = [] @@ -250,6 +259,9 @@ class ChangeLog(object): subsequent_indent=" "*indent2)) def dump(self): + if self.prehead: + self.dumpGraf(self.prehead, 0) + print print self.mainhead for par in self.headtext: self.dumpGraf(par, 2) -- cgit v1.2.3-54-g00ecf