File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
tests/data/serialize/hfml/opf/P000003.opf Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -210,12 +210,13 @@ def apply_index(self):
210
210
for ann_id , topic in self .index_layer ["annotations" ].items ():
211
211
topic_ann = defaultdict (str )
212
212
sub_topics = topic ["parts" ]
213
- for i , sub_topic in enumerate (sub_topics ):
214
- if sub_topic :
215
- vol_id = f"v{ sub_topic ['span' ]['vol' ]:03} "
216
- sub_topic ["type" ] = AnnType .sub_topic
217
- if sub_topic ["work_id" ] != sub_topics [i - 1 ]["work_id" ]:
218
- self .apply_annotation (vol_id , sub_topic )
213
+ for sub_topic_uuid , sub_topic in sub_topics .items ():
214
+ sub_topic_ann = defaultdict (str )
215
+ vol_id = f"v{ sub_topic ['span' ][0 ]['vol' ]:03} "
216
+ sub_topic_ann ["type" ] = AnnType .sub_topic
217
+ sub_topic_ann ["work_id" ] = sub_topic ["work_id" ]
218
+ sub_topic_ann ["span" ] = sub_topic ['span' ][0 ]
219
+ self .apply_annotation (vol_id , sub_topic_ann )
219
220
if topic ["span" ]:
220
221
vol_id = f"v{ topic ['span' ][0 ]['vol' ]:03} "
221
222
topic_ann ["type" ] = AnnType .topic
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ annotation_type: index
3
3
revision : ' 00001'
4
4
annotations :
5
5
12590fb37da14c32ba0785f7f68c6f5e :
6
- parts : []
6
+ parts : {}
7
7
span :
8
8
- vol : 1
9
9
start : 0
@@ -13,7 +13,7 @@ annotations:
13
13
end : 218
14
14
work_id : D1118
15
15
ac26bb9b4a034a0fa959ecc6af68fa0e :
16
- parts : []
16
+ parts : {}
17
17
span :
18
18
- vol : 2
19
19
start : 218
You can’t perform that action at this time.
0 commit comments