[sphinx-dev] filename encoding in epub zip file

2012-04-13 Thread rolmei
Hi,
I would like to change the filename encoding for the files in the epub
zip file
back to the hard-coded UTF-8. It was changed in commit 79ecde1b4dd5
to sys.getfilesystemencoding().
The reason for this change is that the OCF specification (section 3.3)
requires the UTF-8 encoding. Also, using the local filesystem encoding
does
not seem right if the epub is transferred to the real reader(s).

For build systems that use UTF-8 as filesystem encoding it does not
make a difference.

Any objections?
  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.



[sphinx-dev] Re: Bug in epub: toctree hidden -- no text

2012-02-15 Thread rolmei
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.



[sphinx-dev] Re: Bug in epub: toctree hidden -- no text

2012-02-07 Thread 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?

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.



[sphinx-dev] Re: error while making epub

2011-12-22 Thread rolmei
Hi,
my guess is that you have a filename with non-ASCII letters in one of
the files
in conf.py. Try writing that name as unicode string, i.e. u...
instead of 
Does the html build run without errors?

Regards,
  Roland

On 14 Dez., 18:05, Tony Yet 7di...@gmail.com wrote:
 i came upon this error message while using the make epub command, could
 anyone tell me what went wrong and how to fix it?

 thanks.

 here's the error message i got:

   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/environment.py,
 line 758, in read_doc
     pub.set_source(None, src_path.encode(fs_encoding))
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 30:
 ordinal not in range(128)
 The full traceback has been saved in /tmp/sphinx-err-OmFdtd.log, if you
 want to report the issue to the developers.
 Please also report this if it was a user error, so that a better error
 message can be provided next time.
 Either send bugs to the mailing list at 
 http://groups.google.com/group/sphinx-dev/,
 or report them in the tracker at 
 http://bitbucket.org/birkenfeld/sphinx/issues/. Thanks!
 make: *** [epub] Error 1

 and here's the output of the log file:

 # Sphinx version: 1.1
 # Python version: 2.6.5
 # Docutils version: 0.8.1 release
 # Jinja2 version: 2.6
 Traceback (most recent call last):
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/cmdline.py,
 line 189, in main
     app.build(force_all, filenames)
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/application.py,
 line 204, in build
     self.builder.build_update()
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/builders/__init__.py,
 line 196, in build_update
     'out of date' % len(to_build))
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/builders/__init__.py,
 line 216, in build
     purple, length):
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/builders/__init__.py,
 line 120, in status_iterator
     for item in iterable:
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/environment.py,
 line 613, in update_generator
     self.read_doc(docname, app=app)
   File
 /usr/local/lib/python2.6/dist-packages/Sphinx-1.1-py2.6.egg/sphinx/environment.py,
 line 758, in read_doc
     pub.set_source(None, src_path.encode(fs_encoding))
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 30:
 ordinal not in range(128)

-- 
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: Cover Image for epub

2011-11-08 Thread rolmei
Hi,
since version 1.1 the epub builder has the option epub_cover.
Please read the documentation for details.
The html template uses the variables image and title to generate
the cover page. If there are further questions, just ask.

Hope this helps,
  Roland

On 7 Nov., 18:55, Jan Ulrich Hasecke juhase...@googlemail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi,

 can I somehow set a cover image in the epub section of conf.py?

 juh
 - --
 Plone 3http://www.hasecke.com/plone-benutzerhandbuch/3.3.5/
 Plone 4http://www.hasecke.com/plone-benutzerhandbuch/4.0/
 Über PayPal für das Benutzerhandbuch spenden:http://bit.ly/k5ay2E
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (Darwin)
 Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

 iEYEARECAAYFAk64G1AACgkQPUzUEFbILMTCzQCg1BZKfbkU44MqMsEDQ7prBfhG
 aAIAnjXHd1SJ7rfvv9PTPSUJgtOvZ0J8
 =I7u5
 -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.



[sphinx-dev] Re: Hiding header and footer in epub

2011-04-29 Thread rolmei
Hi,

On 28 Apr., 10:17, Jan Ulrich Hasecke juhase...@googlemail.com
wrote:
 I'm aware that I can make a custom theme. I did one before and it wasn't
 fun. ;-)

For this case it might be not this difficult.
You should edit the file _templates/layout.html.
If it does not exist, just add the following contents:

{% extends !layout.html %}
{% block relbar1 %}{% endblock %}
{% block footer %}{% endblock %}

If it already exists, add the last two lines.
You should also check that the conf.py contains
the following line:

templates_path = ['_templates']

That should be sufficient. Rebuild the epub file.
Note that the header and footer are also removed from
the HTML output, so the empty blocks should be removed
if you also want the HTML output.


 But I think simply removing the header and footer is not enough. I my
 point of view an ebook is really a book and not a bunch of html pages.
 This implies that footnotes should not be counted page wise but
 continously through the whole book similar to what the pdf builder does.

 I am not quite sure whether there are use cases that an ebook should be
 compiled from several html pages, so maybe this can be another option:
 make the ebook from one single html page with continously counted
 footnotes or make it from several html pages with chapter wise counting.

In my opinion, creating the epub from one big HTML file is not
feasible
due to memory and cpu constraints.
The readers can only process small files (I try to keep them  100k).
And the rendering of large files can take minutes,

Formatting the footnotes as endnotes might be possible through an
extension.
I think the notes example extension does something similar.
However, for the endnotes you have to renumber the notes and rewrite
the links.

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.



[sphinx-dev] Re: Hiding header and footer in epub

2011-04-27 Thread rolmei

On 26 Apr., 18:54, Jan Ulrich Hasecke juhase...@googlemail.com
wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi all,

 is there any option to hide the header and footer in the epub output? I
 only need the plain text in the output.

 TIA
 juh

Hi,
you can remove the header and footer by using a custom theme that
defines the relbar1 and footer as empty blocks. It is quite easy to
do.
Please read the sphinx documentation for further information.
If there is enough interest, I may add options for the epub builder,
although the options may also be useful for the general HTML builder.

I do not want to remove the header and footer by default, because
they may be of interest for some people.

Hope this helps,
  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.



[sphinx-dev] Re: Generated ePub with subsections crashes Nook reader?

2011-02-01 Thread rolmei
Hi,
I could reproduce the crash on my reader.
I think that the images are the problem.
The original images are grayscale gifs, not color gifs.
I replaced a few images by color images and the HTML pages
had no problem.
Unfortunately I did not find an easy command to convert greyscale
gifs to color gifs with imagemagick or netpbm.

Regards,
  Roland

On 1 Feb., 01:58, Victor Hooi victorh...@gmail.com wrote:
 Hi,

 Also, I should add - Google Groups didn't seem to link my ePub attachment,
 or even a zipped copy of it - so I just zipped it, and renamed it PDF - just
 remove that extension, and unzip it, and you should get the original ePub.

 Cheers,
 Victor

-- 
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: EPUB Output improvements

2010-08-07 Thread rolmei
On 4 Aug., 20:00, Kovid kovidgo...@gmail.com wrote:
 The EPUB standard does not address covers. Basically, the first item
 in the spine is rendered at a screenfull typically 600x800 size and
 used as a cover. However, an informal best practice when creating EPUB
 covers is if the cover is raster image based to link to the actual
 raster image via the meta tag.

 So to summarize, inserting a cover needs the following:

 1) Create a wrapper html file and add it to the manifest. Add a
 reference to the wrapper html as the first item in the spine. The
 wrapper will point to the actual image file (say cover.jpg).
 2) Add cover.jpg to the manifest and add the meta element that links
 to it. Examples are in the sub class I linked to above.


Hi,
I added the epub_cover feature in my fork of sphinx at
http://bitbucket.org/rolmei/sphinx-epub.
Please take a look at it and check if it fits your needs.
The documentation is in the config.rst file.
You should probably create your own html template file,
epub-cover.html is just an example.

The dc:date meta data is also in that fork.

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-...@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: EPUB Output improvements

2010-07-29 Thread rolmei
On 27 Jul., 17:01, Kovid kovidgo...@gmail.com wrote:
 It would be nice to have support for dc:date in the OPF metadata and
 a cover. Both of these are implemented in the EpubBuilder sub class
 here:  
 http://bazaar.launchpad.net/~kovid/calibre/trunk/annotate/head:/src/c...

 Unfortunately I don't have the time to create a patch against epub.py
 in the sphinx trunk, hence the hackish subclassing

Hi,
I'll work on it.
The dc:date part is easy.

For the cover I first have to find the best and most flexible
solution.
Some sources link to a bitmap in the meta cover attribute,
but also add a html file that embeds the image. Is that necessary?
Has this html file to be added to the spine and reference sections?
Your approach is to link to the html file from the meta cover
attribute.
I'll try to figure it out.
Maybe you could give some feedback.

Thanks,
  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-...@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: Error from the epub builder

2010-07-08 Thread rolmei
On 8 Jul., 20:24, Fred Drake fdr...@acm.org wrote:
 On Wed, Jun 30, 2010 at 4:03 PM, rolmei roland_meis...@arcor.de wrote:
  there is a bug fix athttp://bitbucket.org/rolmei/sphinx-epub/.
  However there is only one entry in the toc.ncx file.

 This lets me get a usable epub document; thanks!

 I've still got to play with the various toctree options; my document
 is currently a single file, and no tree is showing up.  But some
 things were going to change anyway.

   -Fred

 --
 Fred L. Drake, Jr.    fdrake at gmail.com
 A storm broke loose in my mind.  --Albert Einstein

Great!
Although the fix broke the builder for the general case of
multiple files (content.opf) ... it worked for you.
I hope that this bug is fixed now.
It was a stupid error, hasattr vs has_key.

I also worked on the crash, and it took longer than I anticipated.
At the moment, the sphinx documentation builds fine,
but I imagine problems for the cpp domain.
... and the file genindex.html shows wrong links.

Expect two more changes to fix the known issues.

Cheers,
  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-...@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: Error from the epub builder

2010-07-02 Thread rolmei
On 2 Jul., 13:02, Fred Drake fdr...@acm.org wrote:
 On Wed, Jun 30, 2010 at 4:03 PM, rolmei roland_meis...@arcor.de wrote:
  there is a bug fix athttp://bitbucket.org/rolmei/sphinx-epub/.
  However there is only one entry in the toc.ncx file.
  I think you only get a full table of contents if
  the toctree directive is used.

 Thanks Roland (Georg)!

 I should get a chance to try this out over the weekend, and will let
 you know how that goes.

   -Fred

 --
 Fred L. Drake, Jr.    fdrake at gmail.com
 A storm broke loose in my mind.  --Albert Einstein

You're welcome!
However currently building epubs is broken with the new domain
concept, see bug #448.
The problem is quite severe as the reader crashes and reboots (at
least the Sony PRS-505).
The fix is easy. Colons in href attributes have to be replaced by some
other character.
At the moment I am waiting for feedback how to proceed.
Should the replacement be done globally for all builders, or should I
apply it only
for the epub builder? There might be side effects if done globally.
Any suggestions?

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-...@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: Error from the epub builder

2010-07-01 Thread rolmei
Hi,
there is a bug fix at http://bitbucket.org/rolmei/sphinx-epub/.
However there is only one entry in the toc.ncx file.
I think you only get a full table of contents if
the toctree directive is used.

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-...@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.