fixed prefixed punctuations winding up in the effective categories of subparts

Mon, 24 Jun 2019 00:54:24 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 24 Jun 2019 00:54:24 +0300
changeset 84
55d52e25267f
parent 83
bd840d5dc8d8
child 85
4438502fd3e0

fixed prefixed punctuations winding up in the effective categories of subparts

header.py file | annotate | diff | comparison | revisions
--- a/header.py	Mon Jun 24 00:51:04 2019 +0300
+++ b/header.py	Mon Jun 24 00:54:24 2019 +0300
@@ -32,7 +32,11 @@
         if self.category:
             return self.category
         else:
-            return self.description.split(' ', 1)[0]
+            import string
+            category = self.description.split(' ', 1)[0]
+            while category and category[0] in string.punctuation:
+                category = category[1:]
+            return category
 
 class BadHeader:
     def __init__(self, index, reason):

mercurial