4

Trying to explain the title: I am creating an EPUB document which is a programming course. In the document I want to refer to texts describing labs: these are not in the main flow of the main document: you can click if you want to read the labs (or not) and then get back to the main document.

In the lab documents there are also links to solutions (you need to click and later come back)

this means I want to have an hypertext tree in my epub with a main text with a normal flow and additions which are not part of the normal flow. How do I do that? thanks

(note: EPUB is created using ASCIIDOC but I can write unix scripts massaging the files in the zip)

  • What do you mean "additions which are not part of the normal flow"? Do you mean that don't appear in the epub navigation document? – idiotprogrammer Oct 8 '17 at 18:39
1

I don't really understand the question, but it is possible for an epub file to contain html files which do not appear in the main navigation document. They can be accessed indirectly through hyperlinks within the HTML document.

See the answer I gave for a different but related question here: https://ebooks.stackexchange.com/a/7211/417

By the way, if that is your question, I recommend ignoring the epub2 way to do it and just do it the epub3 way. A lot of reading systems (including the Kindle ones) are ignoring the toc.ncx document if you have a <nav epub:type="toc"> element.

  • for sure my goal is not clear enough so let's try to clarify: I will get a book where 'normal' flow will be chapt1 then chapt2 ... at the end of chapt1 you may click on a link to read a document named labs1 then you go read this document (if needed) then go back to the end of chapt1. The labs1 document is hosted into the epub file. So instead of having a list of documents (the normal flow) you have a "tree" of documents. – bear Oct 8 '17 at 19:27
  • So you want the docs to be included in the epub or external to it? If included and if the docs are HTML files, then you could simply link to them in such a way: href="otherdoc1.html", href="otherdoc2.html" href="otherdoc3.html" but not have otherdoc1.html listed in the navigation document. Note that the file needs to be still listed in the package.opf file. – idiotprogrammer Oct 8 '17 at 19:59
  • yes I want to have these files included in the epub document. I will try your solution and report the results. Thanks – bear Oct 9 '17 at 9:55
1

as suggested by "idiotprogrammer" it is possible to add such documents that are not part of the 'normal' reading flow.

for instance while using the a2x epub generator from ASCIIDOC it is possible to add html documents that are listed in a RESOURCE_MANIFEST file. these documents are added in the OEBPS directory (in my case in a 'labs' subdirectory of OEBPS) and are not listed as part of the normal flow.

BUT (there is a but) behaviour depends on the epub reader you use: Mac's Ibook works perfectly (you have special window for this lab document and you can come back to the book) but Calibre passes the document to your browser (which is not the thing I would expect)

  • after other tests here are the things to do: documents should be added in the list of items AND in the spine with mention linear="no" -> in that case it seems to work everywhere (but is is not easy to automatize the creation of the opf file ... stil wondering to do that - using an ed script can be done but is complex-) – bear Oct 9 '17 at 15:07
0

I am not sure it's what you want/need, but the easiest way to do it is to add an (internal) anchor to the addendum, and at the end of the addendum another anchor to go back to the main flow.

If the addenda are short, you may also consider putting them in footnotes.

0

apparently there is no need in readers to create another anchor to go back to the main flow (tested with Ibook and Calibre) just adding correctly the documents in the opf file does work (plus the link from the master flow to the "non linear" documents)

0

The link to the file would look like: file://mydir/myfile.txt. But that doesn't mean the editor (like Calibre) would make a valid link out of that. Most programs only look for links that begin with "http://", "https://" or "ftp://" and do not linkify anything else.

On a similar note you would create text like "click here for the lab", select that text, and create a link to "file://mydir/myfile.txt".

So, where your epub is stored, you have to have a folder called "mydir" and under that would be "myfile.txt". The directory tree would look like this:

myepub.epub mydir\myfile.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.