Patch title extraction. Patch provided by Henrik. Fixes #617

- Legacy-Id: 2887
This commit is contained in:
Emilio A. Sánchez López 2011-03-14 14:42:08 +00:00
parent 0dde7786cd
commit fb7219c6ce

View file

@ -575,11 +575,12 @@ class Draft():
def get_title(self):
if self._title:
return self._title
title_re = re.compile('(.+\n){1,3}(\s+<?draft-\S+\s*\n)')
title_re = re.compile('(?:\n\s*\n\s*)((.+\n){1,3})(\s+<?draft-\S+\s*\n)\s*\n')
match = title_re.search(self.pages[0])
if match:
title = match.group(1)
title = title.strip()
title = re.sub('\s*\n\s*', ' ', title)
self._title = title
return self._title
# unusual title extract