Skip to content

Commit bb5e5b9

Browse files
committed
Another tweak to handle page break paragraph joins better in class Draft.
- Legacy-Id: 12840
1 parent 29567ad commit bb5e5b9

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

ietf/utils/draft.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _stripheaders(self):
196196
line = ""
197197
newpage = False
198198
sentence = False
199-
shortline = False
199+
shortprev = False
200200
blankcount = 0
201201
linecount = 0
202202
# two functions with side effects
@@ -238,7 +238,7 @@ def begpage(pages, page, newpage, line=None):
238238
if re.search("\f", line, re.I):
239239
pages, page, newpage = begpage(pages, page, newpage)
240240
continue
241-
if re.search("^ *Internet.Draft.+ .+[12][0-9][0-9][0-9] *$", line, re.I):
241+
if re.search("^ *Internet.Draft.+ .+[12][0-9][0-9][0-9] *$", line, re.I):
242242
pages, page, newpage = begpage(pages, page, newpage, line)
243243
continue
244244
# if re.search("^ *Internet.Draft +", line, re.I):
@@ -263,15 +263,17 @@ def begpage(pages, page, newpage, line=None):
263263
sentence = True
264264
if re.search("[^ \t]", line):
265265
if newpage:
266-
if sentence or shortline:
266+
# 33 is a somewhat arbitrary count for a 'short' line
267+
shortthis = len(line.strip()) < 33 # 33 is a somewhat arbitrary count for a 'short' line
268+
if sentence or (shortprev and not shortthis):
267269
stripped += [""]
268270
else:
269271
if blankcount:
270272
stripped += [""]*blankcount
271273
blankcount = 0
272274
sentence = False
273275
newpage = False
274-
shortline = len(line.strip()) < 18
276+
shortprev = len(line.strip()) < 33 # 33 is a somewhat arbitrary count for a 'short' line
275277
if re.search("[.:]$", line):
276278
sentence = True
277279
if re.search("^[ \t]*$", line):

0 commit comments

Comments
 (0)