Re: [sphinx-dev] Re: Bug in epub: toctree hidden -- no text
Am Mittwoch, den 15.02.2012, 21:27 -0800 schrieb Erik Hetzner: Hi Roland, Thank you for your response! My primary reason for worrying about this is that I would like to be able to build epubs that do not have a table of contents in the main text, but that instead use a ereaders built-in navigation system, features which exist on all ereaders that I know of. I think that hidden toctrees are the right feature to use for this, but I could be wrong. I should note that I am using a custom theme that does not contain any navigation links at all. Here are the results of my test, using your patch. I created a test document with a root toctree entry and 2 child toctrees, each with a single document beneath them. (I can supply these files if you like.) If I use hidden in the root toctree, I indeed get an empty navMap, and an empty spine in the content.opf. In calibre I cannot see anything in the generated epub file. Nor can I view any content in the bookworm.oreilly.com, nor on my nook. If I remove hidden from the root toctree, and add it to a single child toctree, I am unable to access the child toctree. I am unable to navigate in any way to the child of the hidden toctree, in calibre viewer, on bookworm.oreilly.com, and on my nook. I don’t think this is correct behavior, because according to the sphinx docs: This will still notify Sphinx of the document hierarchy, but not insert links into the document at the location of the directive – this makes sense if you intend to insert these links yourself, in a different style, or in the HTML sidebar. [1] I think that the spine element of the content.opf or the toc.ncx file should be considered like an HTML sidebar. 1. http://sphinx.pocoo.org/concepts.html#the-toc-tree best, Erik Sent from my free software system http://fsf.org/. Hi Erik, did you really use the version of sphinx from my branch? Please check which version of sphinx you are using. The results you describe seem to indicate that you are using a version without my changes. They have not yet been pulled into the main branch of sphinx. You can get my version from http://bitbucket.org/rolmei/sphinx-epub. Please also apply the attached patch, it has not been added yet to the bitbucket repository (see the attachment for a slightly different patch). In either case, send me the epub (and the rst sources). I'll take a look at it. By the way, that version also contain epub theme configuration options to remove the relabar1 and footer sections. You don't need the custom theme any more if you set the options. Regards, Roland -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en. diff -r f453d48beacc sphinx/builders/epub.py --- a/sphinx/builders/epub.py Mon Feb 13 21:04:28 2012 +0100 +++ b/sphinx/builders/epub.py Thu Feb 16 17:59:29 2012 +0100 @@ -592,6 +592,8 @@ doctree = self.env.get_and_resolve_doctree(self.config.master_doc, self, prune_toctrees=False, includehidden=False) refnodes = self.get_refnodes(doctree, []) +if not refnodes: +refnodes = self.refnodes navpoints = self.build_navpoints(refnodes) level = max(item['level'] for item in self.refnodes) level = min(level, self.config.epub_tocdepth)
Re: [sphinx-dev] Re: Bug in epub: toctree hidden -- no text
At Thu, 16 Feb 2012 18:03:48 +0100, Roland Meister wrote: Am Mittwoch, den 15.02.2012, 21:27 -0800 schrieb Erik Hetzner: […] Hi Erik, did you really use the version of sphinx from my branch? Please check which version of sphinx you are using. The results you describe seem to indicate that you are using a version without my changes. They have not yet been pulled into the main branch of sphinx. Hi Roland, Thanks for your patience! It was indeed my mistake. I think I must not have loaded the virtualenv where your version was installed. I started a clean virtualenv and rechecked, and I can page through the work. Thanks so much for the fix! You can get my version from http://bitbucket.org/rolmei/sphinx-epub. Please also apply the attached patch, it has not been added yet to the bitbucket repository (see the attachment for a slightly different patch). In either case, send me the epub (and the rst sources). I'll take a look at it. By the way, that version also contain epub theme configuration options to remove the relabar1 and footer sections. You don't need the custom theme any more if you set the options. Thanks, that might be useful. I am trying to put together a site like readthedocs for epubs. I am starting with a very basic theme. best, Erik Sent from my free software system http://fsf.org/. -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
[sphinx-dev] Re: Bug in epub: toctree hidden -- no text
On 15 Feb., 08:41, Erik Hetzner e...@e6h.org wrote: At Mon, 13 Feb 2012 12:55:21 -0800 (PST), Hi Roland, What ebook viewer are you using? It seems that the calibre ebook viewer uses the toc.ncx file for navigation, because when I generate an epub with toctree :hidden: and view it in the calibre ebook-viewer, I am unable to navigate or even turn pages. I’m not sure what the correct behavior is here. I suppose that it depends on the semantics of “hidden” for a toctree. I think that perhaps content listed in the content.opf file should also be in the toc.ncx. best, Erik Sent from my free software system http://fsf.org/. Hi Erik, you are setting the hidden attribute on the root toc entry? Then, indeed, the navMap element in toc.ncx is empty and useless. My use case was to hide only the toc in non-root toc entries. Maybe a compromise is to include the hidden entries in toc.ncx if the navMap would otherwise be empty? Please try the following patch: --- a/sphinx/builders/epub.py Mon Feb 13 21:04:28 2012 +0100 +++ b/sphinx/builders/epub.py Wed Feb 15 18:28:56 2012 +0100 @@ -592,6 +592,10 @@ doctree = self.env.get_and_resolve_doctree(self.config.master_doc, self, prune_toctrees=False, includehidden=False) refnodes = self.get_refnodes(doctree, []) +if not refnodes: +doctree = self.env.get_and_resolve_doctree(self.config.master_doc, +self, prune_toctrees=False, includehidden=True) +refnodes = self.get_refnodes(doctree, []) navpoints = self.build_navpoints(refnodes) level = max(item['level'] for item in self.refnodes) level = min(level, self.config.epub_tocdepth) As an alternative, you can hide the toc listings with css. For calibre, there are the purple left and right arrows to turn pages. Or, use the scrollbar on the right side. The next links inside the epub should also work unless the navigation area (relbar1) is hidden. This works for me even if the navMap in toc.ncx is empty. Regards, Roland -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
Re: [sphinx-dev] Re: Bug in epub: toctree hidden -- no text
At Wed, 15 Feb 2012 09:35:37 -0800 (PST), rolmei wrote: Hi Erik, you are setting the hidden attribute on the root toc entry? Then, indeed, the navMap element in toc.ncx is empty and useless. My use case was to hide only the toc in non-root toc entries. Hi Roland, Thank you for your response! My primary reason for worrying about this is that I would like to be able to build epubs that do not have a table of contents in the main text, but that instead use a ereaders built-in navigation system, features which exist on all ereaders that I know of. I think that hidden toctrees are the right feature to use for this, but I could be wrong. I should note that I am using a custom theme that does not contain any navigation links at all. Here are the results of my test, using your patch. I created a test document with a root toctree entry and 2 child toctrees, each with a single document beneath them. (I can supply these files if you like.) If I use hidden in the root toctree, I indeed get an empty navMap, and an empty spine in the content.opf. In calibre I cannot see anything in the generated epub file. Nor can I view any content in the bookworm.oreilly.com, nor on my nook. If I remove hidden from the root toctree, and add it to a single child toctree, I am unable to access the child toctree. I am unable to navigate in any way to the child of the hidden toctree, in calibre viewer, on bookworm.oreilly.com, and on my nook. I don’t think this is correct behavior, because according to the sphinx docs: This will still notify Sphinx of the document hierarchy, but not insert links into the document at the location of the directive – this makes sense if you intend to insert these links yourself, in a different style, or in the HTML sidebar. [1] I think that the spine element of the content.opf or the toc.ncx file should be considered like an HTML sidebar. 1. http://sphinx.pocoo.org/concepts.html#the-toc-tree best, Erik Sent from my free software system http://fsf.org/. -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
[sphinx-dev] Re: Bug in epub: toctree hidden -- no text
Hi Jan, Erik I'm working on the issue, but I am not yet finished. Do you want the hidden files to appear in the toc.ncx? Roland -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
Re: [sphinx-dev] Re: Bug in epub: toctree hidden -- no text
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Roland, thanks for fixing this. Am 07.02.12 19:49, schrieb rolmei: Hi Jan, Erik I'm working on the issue, but I am not yet finished. Do you want the hidden files to appear in the toc.ncx? I must confess that I am not an epub expert. I think that it would be reasonable to have a toc which is accessible from inside the reader. If this is done by the toc.ncx, the hidden entries should show up there. In my Kindle there is a Go to Menu where I can access the toc. This seems to me the same behaviour as in the PDF output where chapters are listed in the toc but no sub-toc appear at the place where I put the toctree-command. I hope that I could make my point clear. Please ask me if there are any questions. I am more than happy to help. juh - -- Die deutschen Benutzerhandbücher für Plone http://www.hasecke.com/plone-benutzerhandbuch/3.3.5/ http://www.hasecke.com/plone-benutzerhandbuch/4.0/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8xfdwACgkQPUzUEFbILMT+ngCcD0DPiiONgCqHKEUtTuAHpwZM QuwAn2q4OzCatAqJx2F8j+fZlpLLfAyF =ClAc -END PGP SIGNATURE- -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.