hyperlink conversion to azw3 and display on kindle

Bug #1454199 reported by Madar on 2015-05-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

I have the following html part:

<p>text to explain one<a href="#id1">[1]</a></p>
<p>text to explain two<a href="#id2">[2]</a></p>
<p><a name=id1><b>1. </b>explanation one</p>
<p><a name=id2><b>2. </b>explanation two</p>

If i convert this to azw3, the result is this:

<p class="calibre1">text to explain one<a class="calibre2" href="part0000.html#id1">[1]</a></p>

<p class="calibre1">text to explain two<a class="calibre2" href="part0000.html#id2">[2]</a></p>

<p class="calibre1"><a class="calibre2" id="id1" name="id1"><b class="calibre3">1. </b>explanation one</a></p><a class="calibre2" id="id1" name="id1">

</a><p class="calibre1"><a class="calibre2" id="id1" name="id1"></a><a class="calibre2" id="id2" name="id2"><b class="calibre3">2. </b>explanation two</a></p><a class="calibre2" id="id2" name="id2">

</a>

In the second segment you can see an extra <a class="calibre2" id="id1" name="id1"></a> , which confuse the Kindle4 reader. If i read the book in Calibre, and click on the first hyperlink, it's correctly jumping to the first target. However, if i am using the Kindle reader, it's jump to the second - wrong - target. If i convert same text to mobi, and open it on the Kindle4 reader, it works fine. If i remove this extra part from the code by the editing the book, and upload, it works fine.

If i have more hyperlinks in the text, it's become more messy, and the id's wondering around.

calibre version 2.27

Madar (madar2252) on 2015-05-12
description: updated

Your HTML is malformed. Close the <a name> tags properly and you will be
fine. If you do not do that, they will be closed automatically, which
will lead to the situation you have.

 status invalid

Changed in calibre:
status: New → Invalid
Kovid Goyal (kovid) wrote :

I will add some code to the azw3 output in the next release, to detect
and remove duplicate anchors, but you really should fix your HTML.

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

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Madar (madar2252) wrote :

Yes, is my bad, i fixed my html, sorry for the trouble, and thank you for the answer.

Have a nice day!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers