diff --git a/odf2legi/odf2legi.py b/odf2legi/odf2legi.py index ba6accc..371dfa4 100644 --- a/odf2legi/odf2legi.py +++ b/odf2legi/odf2legi.py @@ -968,6 +968,15 @@ def convert_to_legi_xml(content, metadata = None): if speaker_annotation is not None: if speech: # there was a speech, pop it current_top.pop() + if current_top[-1].tag == 'book': + if current_top[-1].getchildren()[-1].tag == 'nosection': + # This is a CRI(COM), and there's a speaker up in the + # document introducing the seance, before any structure. + # Fiddle around the document to change from + # to + current_top.append(current_top[-1].getchildren()[-1]) + current_top[-1].tag = 'preface' + speech = ET.SubElement(current_top[-1], 'speech') current_top.append(speech) ref = ET.SubElement(speech, 'ref')