]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Get the tricky parts of the sphinx conversion working.
authorBen Darnell <ben@bendarnell.com>
Sun, 10 Mar 2013 19:04:06 +0000 (15:04 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 10 Mar 2013 19:04:06 +0000 (15:04 -0400)
website/sphinx/conf.py
website/sphinx/index.rst

index 62bb78371cba22d5555bb422489e19fb01116626..443ce8b46e768198cc4a023518043ad93da873dd 100644 (file)
@@ -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),
+    }
index d04f3bcafce7696cac79be328a0f9e8ec93f4efa..ebf9e6865a9f7884a9844300b9ebbf6eb752ff3a 100644 (file)
@@ -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 <http://www.tornadoweb.org/>`_ is an open source version of
@@ -38,11 +40,13 @@ Quick links
 -----------
 
 * `Documentation <documentation.html>`_
-* `Download version |version| <https://github.com/downloads/facebook/tornado/tornado-|version|.tar.gz>`_ (`release notes </documentation/releases.html>`_)
+* |Download current version|: :current_tarball:`z` (`release notes </documentation/releases.html>`_)
 * `Source (github) <https://github.com/facebook/tornado>`_
 * `Mailing list <http://groups.google.com/group/python-tornado>`_
 * `Wiki <https://github.com/facebook/tornado/wiki/Links>`_
 
+.. |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 <https://github.com/downloads/facebook/tornado/tornado-{{version}}.tar.gz>`_::
+**Manual installation:** Download :current_tarball:`z`:
+
+.. parsed-literal::
 
     tar xvzf tornado-|version|.tar.gz
     cd tornado-|version|