Tue, 28 May 2019 19:18:52 +0300
fix author parsing getting extra spaces in the name
header.py | file | annotate | diff | comparison | revisions |
--- a/header.py Tue May 28 19:11:11 2019 +0300 +++ b/header.py Tue May 28 19:18:52 2019 +0300 @@ -89,30 +89,30 @@ self.skip_to_next() result.description = self.current() self.skip_to_next() - result.name = self.parse_pattern('^Name: (.+)$', 'name')[0] + result.name = self.parse_pattern(r'^Name: (.+)$', 'name')[0] self.skip_to_next() - result.author, result.username = self.parse_pattern(r'^Author: ([^\[]+)\s*(?:\[(.+)\])?$', 'author') + result.author, result.username = self.parse_pattern(r'^Author: ((?:\s*\w+)+) (?:\[([^\]]+)\])?', 'author') for header_entry in self.get_more_header_stuff(): if self.try_to_match( - '^!LDRAW_ORG ' + + r'^!LDRAW_ORG ' \ r'((?:Unofficial_)?(?:' \ - 'Part|' \ - 'Subpart|' \ - 'Primitive|' \ - '8_Primitive|' \ - '48_Primitive|' \ - 'Shortcut' \ - '))\s?' \ - '(.*)$', + r'Part|' \ + r'Subpart|' \ + r'Primitive|' \ + r'8_Primitive|' \ + r'48_Primitive|' \ + r'Shortcut' \ + r'))\s?' \ + r'(.*)$', 'part type'): result.filetype = self.groups[0] result.qualifiers = re.findall(r'(?:Physical_Colour|Alias|ORIGINAL|UPDATE \d\d\d\d-\d\d)', self.groups[1]) elif self.try_to_match( - '^!LICENSE (.+)$', + r'^!LICENSE (.+)$', 'license'): result.license = self.groups[0] elif self.try_to_match( - 'BFC (CERTIFY CW|CERTIFY CCW|NOCERTIFY)', + r'BFC (CERTIFY CW|CERTIFY CCW|NOCERTIFY)', 'bfc'): result.bfc = self.groups[0] elif self.try_to_match(