You can see the output here:
http://lateral.netmanagers.com.ar/static/tutorial-5.pdf
Specifically, the improvement is the TOC in page 115 and the footnote
numbering is now correct across source files.
Don't worry about the TOC being in a strange place, I can move it and intend
to generate the same "parts" as the LaTeX builder does, as soon as I can clean
up the document title.
I would *love* if someone else would try this with his own sphinx documents
since there is probably a lot I am not even looking at.
Currently you need to use this fork of sphinx:
http://bitbucket.org/gminick/sphinx-rst2pdf-builder
And the SVN version of rst2pdf:
http://code.google.com/p/rst2pdf/source/checkout
--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
Roberto Alsina wrote:
> I would *love* if someone else would try this with his own sphinx documents
> since there is probably a lot I am not even looking at.
I am trying to give it a go as the latex -> pdf conversion generated an
unusable document for me.
> http://code.google.com/p/rst2pdf/source/checkout
This ultimately failed for me. I am not quite sure how many thousand
dependencies it has, but several failed to build and then whatever setup
extension it uses was happy with the Ubuntu packages I installed.
However it ended up wanting simplejson 1.9.2, wasn't happy with the
Ubuntu simplejson package (1.9.2-1build1) and the simplejson 1.9.2 it
downloaded has a syntax error in its setup.py. (Specificially error:
Setup script exited with error in simplejson setup command: test_suite
must be a list). And I am running Python 2.6 so it could just use the
Python standard library json module anyway.
Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkpmiZEACgkQmOOfHg372QRg+wCfYbDVNWM+SCur6CbOOqTvszwp
kRwAni3n34wXTgkaZj8FjBjXegQ7JyGl
=QfBt
-----END PGP SIGNATURE-----
Just a dozen or so :-)
> but several failed to build and then whatever setup
> extension it uses was happy with the Ubuntu packages I installed.
It's just setuptools.
> However it ended up wanting simplejson 1.9.2, wasn't happy with the
> Ubuntu simplejson package (1.9.2-1build1) and the simplejson 1.9.2 it
> downloaded has a syntax error in its setup.py. (Specificially error:
> Setup script exited with error in simplejson setup command: test_suite
> must be a list). And I am running Python 2.6 so it could just use the
> Python standard library json module anyway.
Remove it from setup.py then, it should work just fine.
I can't remove it by default, because it's supposed to work with python 2.4.
Since my last progress report there have been a bunch of changes:
* The toctree works much better
* A LaTeX-like cover page was added
* pdf_documents option similar to latex_documents
* Syntax highlighting was fixed
* footnotes are prettier
And many smaller tweaks.
Here's the usual test document (the spanish translation of the python
tutorial):
http://lateral.netmanagers.com.ar/static/tutorial-7.pdf
Also as usual, to test it you need this sphinx fork:
http://bitbucket.org/gminick/sphinx-rst2pdf-builder
And this rst2pdf:
Roberto Alsina wrote:
> Remove it from setup.py then, it should work just fine.
I had assumed it was one the dependencies that was insisting on
simplejson, but fortunately it was the top level setup.py so that did
turn out to be easy.
The generated and then edited Makefile/conf.py for my docs predates your
work. Consequently the build gives this message:
> WARNING: no "pdf_documents" config value found; no documents will be written
> build succeeded, 1 warning.
Can I suggest either giving a URL as part of that message to information
on what it should be set to, or just defaulting to using the project and
version to generate a suitable config value?
I used sphinx-quickstart to generate a dummy Makefile/conf.py to see
what the values should be. It looks like some of the keys and dummy
values are copied from Latex and so don't make too much sense! It also
isn't clear what the defaults are (eg is compressed on or off by default?)
The build fails for me. There are an initial bunch of warnings about
duplicate explicit targets and then an exception. Details are lower
down. You will probably find it easiest to work against my project to
diagnose. Some of the doc is generated, so here the complete steps you
need to run to try out the pdf generator:
$ hg clone https://apsw.googlecode.com/hg/ apsw
$ cd apsw
$ python setup.py build_ext --inplace --fetch-sqlite
$ make docs # don't worry about htmlhelp not building
$ cd doc
$ make VERSION=1.2.3 pdf # rerun this each time to get pdf build
These are the warnings and error:
> sphinx-build -q -b pdf -d build/doctrees . build/pdf
> <string>:: (WARNING/2) Duplicate explicit target name: "(connection method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(blob method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(connection method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(blob method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(cursor method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(cursor method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "[1]".
> <string>:: (WARNING/2) Duplicate explicit target name: "[1]".
> <string>:: (WARNING/2) Duplicate explicit target name: "(cursor method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "(cursor method)".
> <string>:: (WARNING/2) Duplicate explicit target name: "[1]".
> Exception occurred:
> File "/usr/lib/python2.6/dist-packages/docutils/nodes.py", line 1556, in unknown_visit
> if (node.document.settings.strict_visitor
> AttributeError: 'NoneType' object has no attribute 'settings'
Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkpqAXsACgkQmOOfHg372QQ5BgCffHZV+vW250Z+BIf0nO2PkB7i
8vEAnjVIrfVZnxVZblp1rBNdtKM351Om
=ztf6
-----END PGP SIGNATURE-----
Will take a look at it tonight.
I am currently trying to run the django docs thtough rst2pdf and it's just
*this* close to working :-)
And it passed :-)
There are some obvious bugs in the output, but if it can produce a freaking
665-page manual which uses custom extensions to sphinx there is hope yet!
http://lateral.netmanagers.com.ar/static/django.pdf
The problem with apsw I have not figured out yet, though.
That's totally awesome. Can you share what you did to make this
happen? Did you need to change anything to Django's config to make
this work? Feel free to email me off-list if you don't want to derail.
Jacob
Very impressive! I think it would be best to release it as an extension
right now, since Sphinx 1.0 will take some time yet, and we'll merge it
after it has seen more widespread testing.
cheers,
Georg
Would love to. Any pointers as to how to do this as an extension?
The code is pretty much limited to builders/pdf.py and writers/pdf.py plus
some minimal stuff in config.py and the quickstart script.
Roberto,
>> Very impressive! I think it would be best to release it as an extension
>> right now, since Sphinx 1.0 will take some time yet, and we'll merge it
>> after it has seen more widespread testing.
>
> Would love to. Any pointers as to how to do this as an extension?
> The code is pretty much limited to builders/pdf.py and writers/pdf.py plus
> some minimal stuff in config.py and the quickstart script.
I have created a base for the extension. It's available here:
http://tosh.pl/gminick/code/pdfbuilder.py
I have also updated it a bit to work with Sphinx's code from the main
repository (moduleindex instead of sys.env.modules), so you may have
to update your version of Sphinx to check it out.
Unfortunately, it won't work yet. It throws an error when I try to build
the docs:
Exception occurred:
File
"/usr/local/lib/python2.6/site-packages/rst2pdf-0.11-py2.6.egg/rst2pdf/utils.py",
line 37, in parseRaw
elements.append(Spacer(int(tokens[1]), int(tokens[2])))
ValueError: invalid literal for int() with base 10: '3cm'
I guess you will know how to fix it :-) In case you don't, please let me
know, I will investigate it further.
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
Roberto Alsina napisał(a):
Roberto,
I have created a base for the extension. It's available here:
>> Very impressive! I think it would be best to release it as an extension
>> right now, since Sphinx 1.0 will take some time yet, and we'll merge it
>> after it has seen more widespread testing.
>
> Would love to. Any pointers as to how to do this as an extension?
> The code is pretty much limited to builders/pdf.py and writers/pdf.py plus
> some minimal stuff in config.py and the quickstart script.
http://tosh.pl/gminick/code/pdfbuilder.py
I have also updated it a bit to work with Sphinx's code from the main
repository (moduleindex instead of sys.env.modules), so you may have
to update your version of Sphinx to check it out.
In such case changing these lines in pdfbuilder.py:
---
149 # This is stolen from the HTML builder
150 moduleindex = self.env.domaindata['py']['modules']
151 if self.config.pdf_use_modindex and moduleindex:
152 modules = sorted(((mn, ('#module-' + mn, sy, pl, dep))
153 for (mn, (fn, sy, pl, dep)) in moduleindex.iteritems()),
154 key=lambda x: x[0].lower())
---
into:
---
149 # This is stolen from the HTML builder
150
151 if self.config.pdf_use_modindex and sys.env.modules:
152 modules = sorted(((mn, ('#module-' + mn, sy, pl, dep))
153 for (mn, (fn, sy, pl, dep)) in
sys.env.modules.iteritems()),
154 key=lambda x: x[0].lower())
---
should be enough (IIRC) :)
That's because your rst2pdf is too old, this needs current SVN.
Sure, there are a bunch included with rst2pdf, including one called sphinx
that tries to look a bit like the web output.
> - Is is possible / planned to add chapter numbering ?
Sure. The TOC support is incomplete, it lacks that and a working maxdepth.
I just want to add that you should not base it on trunk; the details of
the domain API are not yet stable.
Georg