Fix bug 2587: Only add \n's to head if they are not alreay present.

This commit is contained in:
John Schember 2009-06-15 20:25:19 -04:00
parent 7999b3c188
commit fb92bbbf50

View File

@ -21,7 +21,9 @@ _span_pat = re.compile('<span.*?</span>', re.DOTALL|re.IGNORECASE)
def sanitize_head(match): def sanitize_head(match):
x = match.group(1) x = match.group(1)
x = _span_pat.sub('', x) x = _span_pat.sub('', x)
return '<head>\n'+x+'\n</head>' x = ('\n%s' % x) if not x.startswith('\n') else x
x += '\n' if not x.endswith('\n') else ''
return '<head>%s</head>' % x
def chap_head(match): def chap_head(match):
chap = match.group('chap') chap = match.group('chap')