Commits

Luke Plant committed 9173ef9

Make get_structure respect existing IDs on elements

This will allow presentation info to stick to sections more easily

Comments (0)

Files changed (1)

semanticeditor/utils/presentation.py

     for n in root.getiterator():
         if n.tag in blockdef:
             text = flatten(n)
-            sect_id = make_sect_id(n.tag, sect_ids)
+            sect_id = n.get('id', '')
+            if sect_id == '' or not sect_id.startswith(n.tag):
+                sect_id = make_sect_id(n.tag, sect_ids)
             sect_ids.add(sect_id)
             if n.tag in headingdef:
                 name = text