Bookmarks on graphics or empty paragraphs break Table of Contents

Bug #1683017 reported by Mark Batten-Carew on 2017-04-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Calibre version 2.79.1 [64 bit]
Windows 7 Home Premium, SP1

I am importing a DOCX file with a 7-entry Table of Contents, which consists of links to MS Word bookmarks inside the DOCX file.

After converting to EPUB and attempting to upload the EPUB to, Kobo reports the following error:

Your eBook can be published, but we strongly recommend you fix these non-critical errors first.
1 Resource failures
1 instance(s) similar to Fragment identifier is not defined.
Fragment identifier is not defined. in index_split_000.html#id_TTB_Afterword, line 15

In my MS Word file I did have a bookmark called "TTB_Afterword", but it was initially attached to a graphic (sole content of a paragraph). I then moved the bookmark to an empty paragraph before the graphic and that didn't help - same error. I then moved the bookmark to a line of text and it worked properly.

Note that this initially occurred on two different links, and both were solved the same way. Move the bookmark from a graphic or empty paragraph to some text in a paragraph.

Another symptom: With the DOCX loaded into Calibre, when I made the first conversion from DOCX to EPUB, and asked to review the TOC at the end of the conversion, Calibre listed the TOC entry points (eg TTB_Afterword) with red circles, meaning they were not pointing to valid locations. That symptom disappeared when I moved the bookmark to a valid line of text.

Before I discovered that moving the bookmarks solved the problem (as proven by no red circle warnings), I was manually deleting the bad entries and re-selecting the same index entry in the file to manually re-create the TTB_Afterword TOC entry. Those were recreated with green circles so I thought everything was fine, but Kobo still rejected those entries.

I have attached a sample docx which, if you attempt conversion to EPUB, with "Review TOC" ticked, you will see a red TOC entry. That bookmark is attached to a graphic.

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers