mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
py3: use proper dict.keys() handling
This commit is contained in:
parent
4b0e241555
commit
a8a74b7c53
@ -608,12 +608,10 @@ if another paragraph_def is found, the state changes to collect_tokens.
|
|||||||
# when determining uniqueness for a style, ingorne these values, since
|
# when determining uniqueness for a style, ingorne these values, since
|
||||||
# they don't tell us if the style is unique
|
# they don't tell us if the style is unique
|
||||||
ignore_values = ['style-num', 'nest-level', 'in-table']
|
ignore_values = ['style-num', 'nest-level', 'in-table']
|
||||||
keys = self.__att_val_dict.keys()
|
for k, v in self.__att_val_dict.items():
|
||||||
keys.sort()
|
if k in ignore_values:
|
||||||
for key in keys:
|
|
||||||
if key in ignore_values:
|
|
||||||
continue
|
continue
|
||||||
my_string += '%s:%s' % (key, self.__att_val_dict[key])
|
my_string += '%s:%s' % (k, v)
|
||||||
if my_string in self.__style_num_strings:
|
if my_string in self.__style_num_strings:
|
||||||
num = self.__style_num_strings.index(my_string)
|
num = self.__style_num_strings.index(my_string)
|
||||||
num += 1 # since indexing starts at zero, rather than 1
|
num += 1 # since indexing starts at zero, rather than 1
|
||||||
@ -637,12 +635,9 @@ if another paragraph_def is found, the state changes to collect_tokens.
|
|||||||
the_value = self.__att_val_dict['tabs']
|
the_value = self.__att_val_dict['tabs']
|
||||||
# the_value = the_value[:-1]
|
# the_value = the_value[:-1]
|
||||||
style_string += ('<%s>%s' % ('tabs', the_value))
|
style_string += ('<%s>%s' % ('tabs', the_value))
|
||||||
keys = self.__att_val_dict.keys()
|
for k, v in self.__att_val_dict.items():
|
||||||
keys.sort()
|
if k not in ['name', 'style-num', 'in-table'] + tabs_list:
|
||||||
for key in keys:
|
style_string += ('<%s>%s' % (k, v))
|
||||||
if key != 'name' and key !='style-num' and key != 'in-table'\
|
|
||||||
and key not in tabs_list:
|
|
||||||
style_string += ('<%s>%s' % (key, self.__att_val_dict[key]))
|
|
||||||
style_string += '\n'
|
style_string += '\n'
|
||||||
self.__body_style_strings.append(style_string)
|
self.__body_style_strings.append(style_string)
|
||||||
|
|
||||||
@ -690,11 +685,9 @@ if another paragraph_def is found, the state changes to collect_tokens.
|
|||||||
the_value = self.__att_val_dict['tabs']
|
the_value = self.__att_val_dict['tabs']
|
||||||
# the_value = the_value[:-1]
|
# the_value = the_value[:-1]
|
||||||
self.__write_obj.write('<%s>%s' % ('tabs', the_value))
|
self.__write_obj.write('<%s>%s' % ('tabs', the_value))
|
||||||
keys = self.__att_val_dict.keys()
|
keys = sorted(self.__att_val_dict.keys())
|
||||||
keys.sort()
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if key != 'name' and key !='style-num' and key != 'in-table'\
|
if key not in ['name', 'style-num', 'in-table'] + tabs_list:
|
||||||
and key not in tabs_list:
|
|
||||||
self.__write_obj.write('<%s>%s' % (key, self.__att_val_dict[key]))
|
self.__write_obj.write('<%s>%s' % (key, self.__att_val_dict[key]))
|
||||||
self.__write_obj.write('\n')
|
self.__write_obj.write('\n')
|
||||||
self.__write_obj.write(self.__start2_marker)
|
self.__write_obj.write(self.__start2_marker)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user