From 67664e7956b08b01e734b21244d73c5ea3341b55 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 27 Jan 2014 16:55:17 +0530 Subject: [PATCH] Extend workaround for textboxes to also apply to bookmarks/hyperlinks --- src/calibre/ebooks/docx/to_html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index 1ba8e07182..1ac03840cb 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -382,7 +382,9 @@ class Convert(object): return x for x in descendants(p, 'w:r', 'w:bookmarkStart', 'w:hyperlink'): - if x.tag.endswith('}r') and p_parent(x) is p: + if p_parent(x) is not p: + continue + if x.tag.endswith('}r'): span = self.convert_run(x) if current_anchor is not None: (dest if len(dest) == 0 else span).set('id', current_anchor)