From 30ee00b33bec4b9e1e422f2dedda81eff57b2338 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 11 Aug 2012 09:07:33 -0700 Subject: [PATCH 1/3] Add latex_documents configuration so readthedocs can build pdfs of the docs. --- website/sphinx/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/sphinx/conf.py b/website/sphinx/conf.py index 84f833e6..d429c724 100644 --- a/website/sphinx/conf.py +++ b/website/sphinx/conf.py @@ -48,7 +48,7 @@ coverage_ignore_functions = [ "doctests", "main", ] - + html_static_path = [os.path.abspath("../static")] html_style = "sphinx.css" highlight_language = "none" @@ -74,3 +74,7 @@ html_theme_options = dict( headfont="Calibri, sans-serif", stickysidebar=True, ) + +latex_documents = [ + ('index', 'tornado', 'Tornado Documentation', 'Facebook', 'manual', False), + ] From 359f5a3c9bd37a4a24a9b63a684b3566bffaca66 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 11 Aug 2012 12:09:57 -0700 Subject: [PATCH 2/3] Latex output file must end in .tex --- website/Makefile | 13 ++++++++++++- website/sphinx/conf.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/website/Makefile b/website/Makefile index 6032d149..202e2d13 100644 --- a/website/Makefile +++ b/website/Makefile @@ -9,5 +9,16 @@ coverage: sphinx-build -b coverage ${SPHINXOPTS} sphinx/build/coverage cat sphinx/build/coverage/python.txt +.PHONY: latex +latex: + sphinx-build -b latex $(SPHINXOPTS) sphinx/build/latex + +# Building a pdf requires a latex installation. For macports, the needed +# packages are texlive-latex-extra and texlive-fonts-recommended. +# The output is in sphinx/build/latex/tornado.pdf +.PHONY: pdf +pdf: latex + cd sphinx/build/latex && pdflatex -interaction=nonstopmode tornado.tex + clean: - rm -rf sphinx/build \ No newline at end of file + rm -rf sphinx/build diff --git a/website/sphinx/conf.py b/website/sphinx/conf.py index d429c724..86992f44 100644 --- a/website/sphinx/conf.py +++ b/website/sphinx/conf.py @@ -76,5 +76,5 @@ html_theme_options = dict( ) latex_documents = [ - ('index', 'tornado', 'Tornado Documentation', 'Facebook', 'manual', False), + ('index', 'tornado.tex', 'Tornado Documentation', 'Facebook', 'manual', False), ] From 1acac15d56cebe1c00f6594cf4ee83af345927e5 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 11 Aug 2012 12:14:09 -0700 Subject: [PATCH 3/3] Update doc examples for xsrf_form_html. {% module %} or {% raw %} must be used now due to auto-escaping. --- website/sphinx/overview.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/website/sphinx/overview.rst b/website/sphinx/overview.rst index c3ef03cf..6557ee0f 100644 --- a/website/sphinx/overview.rst +++ b/website/sphinx/overview.rst @@ -192,7 +192,7 @@ There are three ways to return an error from a `RequestHandler`: The default error page includes a stack trace in debug mode and a one-line description of the error (e.g. "500: Internal Server Error") otherwise. To produce a custom error page, override `RequestHandler.write_error`. -This method may produce output normally via methods such as +This method may produce output normally via methods such as `~RequestHandler.write` and `~RequestHandler.render`. If the error was caused by an exception, an ``exc_info`` triple will be passed as a keyword argument (note that this exception is not guaranteed to be the current @@ -203,7 +203,7 @@ In Tornado 2.0 and earlier, custom error pages were implemented by overriding ``RequestHandler.get_error_html``, which returned the error page as a string instead of calling the normal output methods (and had slightly different semantics for exceptions). This method is still supported, but it is -deprecated and applications are encouraged to switch to +deprecated and applications are encouraged to switch to `RequestHandler.write_error`. Redirection @@ -527,7 +527,7 @@ function ``xsrf_form_html()``, available in all templates: ::
- {{ xsrf_form_html() }} + {% module xsrf_form_html() %}
@@ -695,7 +695,7 @@ Here is a properly localized template:
{{ _("Username") }}
{{ _("Password") }}
- {{ xsrf_form_html() }} + {% module xsrf_form_html() %} @@ -1105,4 +1105,3 @@ AppEngine `_ application: See the `appengine example application `_ for a full-featured AppEngine app built on Tornado. -