Fix title extraction. Patch provided to yaco 2011-03-14, committed to yaco/idsubmit branch as [2887].

- Legacy-Id: 2918
Note: SVN reference [2887] has been migrated to Git commit fb7219c6ce
This commit is contained in:
Henrik Levkowetz 2011-03-24 12:58:33 +00:00
parent 9ae7b90b59
commit 61300a9354

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