From 0b9e5ce9c854517dcdc1a7a09d996315e45dc825 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 10 Mar 2013 15:04:06 -0400 Subject: [PATCH] Get the tricky parts of the sphinx conversion working. --- website/sphinx/conf.py | 20 +++++++++++++++++++- website/sphinx/index.rst | 16 +++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/website/sphinx/conf.py b/website/sphinx/conf.py index 62bb7837..443ce8b4 100644 --- a/website/sphinx/conf.py +++ b/website/sphinx/conf.py @@ -11,7 +11,12 @@ copyright = "2011, Facebook" version = release = tornado.version -extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.viewcode"] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.coverage", + "sphinx.ext.extlinks", + "sphinx.ext.viewcode", + ] primary_domain = 'py' default_role = 'py:obj' @@ -79,3 +84,16 @@ html_theme_options = dict( latex_documents = [ ('index', 'tornado.tex', 'Tornado Documentation', 'Facebook', 'manual', False), ] + +# HACK: sphinx has limited support for substitutions with the |version| +# variable, but there doesn't appear to be any way to use this in a link +# target. +# http://stackoverflow.com/questions/1227037/substitutions-inside-links-in-rest-sphinx +# The extlink extension can be used to do link substitutions, but it requires a +# portion of the url to be literally contained in the document. Therefore, +# this link must be referenced as :current_tarball:`z` +extlinks = { + 'current_tarball': ( + 'https://github.com/downloads/facebook/tornado/tornado-%s.tar.g%%s' % version, + 'tornado-%s.tar.g' % version), + } diff --git a/website/sphinx/index.rst b/website/sphinx/index.rst index d04f3bca..ebf9e686 100644 --- a/website/sphinx/index.rst +++ b/website/sphinx/index.rst @@ -1,7 +1,9 @@ -Tornado Web Server -================== +.. title:: Tornado Web Server -.. image:: tornado.png +|Tornado Web Server| +==================== + +.. |Tornado Web Server| image:: tornado.png :alt: Tornado Web Server `Tornado `_ is an open source version of @@ -38,11 +40,13 @@ Quick links ----------- * `Documentation `_ -* `Download version |version| `_ (`release notes `_) +* |Download current version|: :current_tarball:`z` (`release notes `_) * `Source (github) `_ * `Mailing list `_ * `Wiki `_ +.. |Download current version| replace:: Download version |version| + Hello, world ------------ @@ -76,7 +80,9 @@ includes demo applications that are not present when Tornado is installed in this way, so you may wish to download a copy of the source tarball as well. -**Manual installation:** Download `tornado-|version|.tar.gz `_:: +**Manual installation:** Download :current_tarball:`z`: + +.. parsed-literal:: tar xvzf tornado-|version|.tar.gz cd tornado-|version|