Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 11-26-2013, 04:22 PM   #1
oecherprinte
Zealot
oecherprinte began at the beginning.
 
Posts: 115
Karma: 20
Join Date: Jul 2010
Device: Kindle3 3G, Kindle Paperwhite 2
Question How to insert links between articles?

Hi,

I would like to introduce links between articles of a periodical. My idea was to
introduce an anchor in front of every article title:

Code:
<a name="anchor"><\a><title>Whatever<\title>
and then introduce a linke in other articles like this:

Code:
<a href="#anchor">Link</a>
However, this approach does not seem to work when I generate a mobi output file. When I click on the link I always end up at the top of the article containing the link but not at the anchor.

To my understanding all the articles are flattened into the same mobi file. So these types of links should work right?

Are there any other ways of doing this?

Thanks,

Jens
oecherprinte is offline   Reply With Quote
Old 11-26-2013, 09:35 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,964
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You cant do that, you need to include the file name as well. However, doing so is not trivial, since articles are downloaded asynchrously so you dont know what filename an article will have in advance.

What you should do is use a uuid as the anchor and then implement postprocess_book to insert the links.
kovidgoyal is offline   Reply With Quote
Advert
Old 11-27-2013, 04:34 AM   #3
oecherprinte
Zealot
oecherprinte began at the beginning.
 
Posts: 115
Karma: 20
Join Date: Jul 2010
Device: Kindle3 3G, Kindle Paperwhite 2
Thanks for the fast reply!

Do you have any more detailed documentation about postprocess_book? I get an oeb object in that function. How can I explore this object, extract the filenames and access the html code inside them.

Sounds like an elegant solution.

However, if everything fails I can still predict the feednumbers and filenames if I only allow a singe download at a time, right?

Thanks,

Jens
oecherprinte is offline   Reply With Quote
Old 11-27-2013, 04:37 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,964
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is no documentation, but thge oeb object is the same as that used throughout the calibre conversion pipeline. If you just search the calibre code for postprocess_book, you will see some examples.

Yes, restricting to a single thread should yield predictable filenames.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
0.6 best way to insert hyperlinks?? phossler Sigil 16 11-21-2012 09:36 AM
Insert a Picture? MickeyC Feedback 6 06-13-2011 12:39 PM
Insert Hyperlinks in Feed Articles Bushwil Recipes 1 01-21-2011 02:51 PM
Links to URLs work, internal links don't? NewDay ePub 36 10-27-2010 04:09 AM
Insert metadata Landrovan Calibre 1 10-05-2009 01:36 PM


All times are GMT -4. The time now is 10:10 AM.


MobileRead.com is a privately owned, operated and funded community.