DOCX Input: Fix ToC nesting not working if the styles for the ToC levels dont use integer margins

This commit is contained in:
Kovid Goyal 2024-11-08 22:00:31 +05:30
parent 7fee97c627
commit 1246c326ed
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -123,7 +123,7 @@ def from_toc(docx, link_map, styles, object_map, log, namespace):
if txt and href and p is not None:
ps = styles.resolve_paragraph(p)
try:
ml = int(ps.margin_left[:-2])
ml = float(ps.margin_left[:-2])
except (TypeError, ValueError, AttributeError):
ml = 0
if ps.text_align in {'center', 'right'}: