| for csur in ['Klingon']: | for csur in ['Klingon']: | ||||
| for data in ucd.parse_ucd_data('data/csur', csur): | for data in ucd.parse_ucd_data('data/csur', csur): | ||||
| for codepoint in data['CodePoint']: | for codepoint in data['CodePoint']: | ||||
| if not 'TitleCase' in data: data['TitleCase'] = codepoint | |||||
| if not 'UpperCase' in data: data['UpperCase'] = codepoint | |||||
| if not 'LowerCase' in data: data['LowerCase'] = codepoint | |||||
| if not 'Properties' in data: data['Properties'] = [] | |||||
| unicode_chars[codepoint] = data | unicode_chars[codepoint] = data | ||||
| null = ucd.CodePoint('0000') | null = ucd.CodePoint('0000') | ||||
| try: | try: | ||||
| data = unicode_chars[codepoint] | data = unicode_chars[codepoint] | ||||
| except KeyError: | except KeyError: | ||||
| data = {'GeneralCategory': 'Cn', 'TitleCase': codepoint, 'UpperCase': codepoint, 'LowerCase': codepoint, 'Properties': []} | |||||
| try: | |||||
| script = data['Script'] | |||||
| except KeyError: | |||||
| script = 'Zzzz' | |||||
| title = data['TitleCase'] | |||||
| upper = data['UpperCase'] | |||||
| lower = data['LowerCase'] | |||||
| data = {} | |||||
| script = data.get('Script', 'Zzzz') | |||||
| title = data.get('TitleCase', codepoint) | |||||
| upper = data.get('UpperCase', codepoint) | |||||
| lower = data.get('LowerCase', codepoint) | |||||
| if title == null: title = codepoint | if title == null: title = codepoint | ||||
| if upper == null: upper = codepoint | if upper == null: upper = codepoint | ||||
| if lower == null: lower = codepoint | if lower == null: lower = codepoint | ||||
| print('%s %s %s %s %s %s %s %s' % ( | print('%s %s %s %s %s %s %s %s' % ( | ||||
| codepoint, script, | codepoint, script, | ||||
| data['GeneralCategory'][0], data['GeneralCategory'], | |||||
| data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'), | |||||
| upper, lower, title, | upper, lower, title, | ||||
| ' '.join(data['Properties']))) | |||||
| ' '.join(data.get('Properties', [])))) |