# HG changeset patch # User Teemu Piippo # Date 1559060332 -10800 # Node ID cd2b4f3c1189507bb9a9486f7ac0563735c15065 # Parent 913ec927c95d4986c85e39f28b2d4488c96f4a57 fix author parsing getting extra spaces in the name diff -r 913ec927c95d -r cd2b4f3c1189 header.py --- 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(