From 901e650e9d89e1d8e15b7ceb4e5cab25e447bf70 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 May 2017 12:41:34 +0530 Subject: [PATCH] DOCX Output: Fix links to empty inline tags not working. Fixes #1683188 [Losing all bookmarks while converting azw3 files to docx](https://bugs.launchpad.net/calibre/+bug/1683188) --- src/calibre/ebooks/docx/writer/from_html.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/docx/writer/from_html.py b/src/calibre/ebooks/docx/writer/from_html.py index 08351e85b2..e12d3fa39c 100644 --- a/src/calibre/ebooks/docx/writer/from_html.py +++ b/src/calibre/ebooks/docx/writer/from_html.py @@ -568,6 +568,9 @@ class Convert(object): if html_tag.text: block = self.create_block_from_parent(html_tag, stylizer) block.add_text(html_tag.text, tag_style, is_parent_style=False, bookmark=bmark, link=self.current_link, lang=self.current_lang) + elif bmark: + block = self.create_block_from_parent(html_tag, stylizer) + block.bookmarks.add(bmark) def bookmark_for_anchor(self, anchor, html_tag): return self.links_manager.bookmark_for_anchor(anchor, self.current_item, html_tag)