MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Conversion (https://www.mobileread.com/forums/forumdisplay.php?f=235)
-   -   Odd link problem (https://www.mobileread.com/forums/showthread.php?t=241116)

Julanna 06-15-2014 08:28 AM

Odd link problem
 
I usually create simple epubs, just fiction, simple formatting. Recently I've helped create a small non-fiction book that has an index. I used very simple html coding:

<a name="John Wylde">John Wylde</a>

<a href="#John Wylde">Wylde, John</a>

but the text being linked to is showing blue and underlined as if it's a link. It's not a link, the link is in the index and works fine. This shows up wrong on the PC using Digital Editions but not in the Calibre viewer. It is a problem on the Kobo e-ink and on the Android smartphone. They are the only devices I have to test on.

With such simple coding I can't work out why it displays wrong. Any ideas appreciated!

kovidgoyal 06-15-2014 09:00 AM

Use

<span id="John Wylde">John Wylde</a>

instead of

<a name="John Wylde">John Wylde</a>

eschwartz 06-15-2014 12:30 PM

2 problems
 
Quote:

Originally Posted by kovidgoyal (Post 2851850)
Use

<span id="John Wylde">John Wylde</a>

instead of

<a name="John Wylde">John Wylde</a>

closes with </span> not </a> (typo)

<a> would create a named link, even if it isn't active. The id= attribute can also be linked to, however. You can add this to any element; if you are linking to the beginning of a paragraph, change <p> to <p id="John-Wylde">.

The id attribute cannot contain spaces.

Julanna 06-16-2014 07:31 AM

So far so good: all the <span id="name">name</span>s are in - cept of course the links in the index aren't going to work as <a href="#name">name</a>. I'm not used to using spans so I'm not sure what the other half should be. Help? Is it suppose to be <span href etc???

eschwartz 06-16-2014 12:25 PM

The <element id=""> creates a link target, just like <a name=""> does.

You still use <a href=""> for all links.

Julanna 06-16-2014 05:17 PM

<a href="#John Wylde">Wylde, John</a>

<span id="John Wylde">John Wylde</span>

This works in Calibre viewer but nothing else.
Looking forward to the day when there are standards for epubs. Maybe one day. I think i'll stick to simple fiction from now on!

eschwartz 06-16-2014 06:33 PM

In post #3 I did say id cannot have spaces... Spaces imply that there are two ids: "John" and "Wylde", not one long id.

Use a hyphen or underscore. That is the standard. ;)

Sabardeyn 06-16-2014 07:20 PM

Quote:

Originally Posted by Julanna (Post 2852779)
Looking forward to the day when there are standards for epubs. Maybe one day.

The problem is more about multiple ebook file formats and various implementations than anything else. Every manufacturer wants something slightly different and few of them are adhering 100% to the standards that do exist.

Eventually everything will work out, but it will take a while yet. My guess? Two years before we finally start seeing a more universal feature set and it's implementation. It's that last bit that is most important.

eschwartz 06-16-2014 08:57 PM

Quote:

Originally Posted by Sabardeyn (Post 2852870)
The problem is more about multiple ebook file formats and various implementations than anything else. Every manufacturer wants something slightly different and few of them are adhering 100% to the standards that do exist.

Eventually everything will work out, but it will take a while yet. My guess? Two years before we finally start seeing a more universal feature set and it's implementation. It's that last bit that is most important.

Or we could just go with the current standards that say you can't use spaces in an id, regardless of whether it works sometimes.

Julanna 06-17-2014 06:18 AM

Ah the spaces eschwartz! I'll try that shortly. I thought you meant no spaces in the code itself.

Sabardeyn, you are optimistic. Think of the browsers and how they have never quite got it together. Instead of browser wars we have reader wars! :)

Julanna 06-19-2014 04:19 AM

Thank you eschwartz, after lots of repairs it has worked. I haven't tested in all the devices so far but if it's looking good in ADE then I'm thinking it will be ok in the rest.

Still mildly annoying that ordinary html behaves one way in a browser and another way in an e-reader, but now that I've got a work around it's only mildly.


All times are GMT -4. The time now is 07:16 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.