From 3e05dffc7b0a40a2f7728905d21b7bfcb715e487 Mon Sep 17 00:00:00 2001 From: Anne Gentle Date: Mon, 2 Feb 2015 16:11:29 -0600 Subject: [PATCH] Theme needs a setup function to be used from package Change-Id: I2212941f09b00f5c0cbc29217fe59cfa408367a0 --- ...gure_access_and_security_for_instances.rst | 4 ++-- doc/source/create_and_manage_databases.rst | 6 ++--- doc/source/index.rst | 18 ++++++++++---- openstackdocstheme/__init__.py | 24 ++++++++++++++++++- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/doc/source/configure_access_and_security_for_instances.rst b/doc/source/configure_access_and_security_for_instances.rst index a1e6450e..ea2d0296 100644 --- a/doc/source/configure_access_and_security_for_instances.rst +++ b/doc/source/configure_access_and_security_for_instances.rst @@ -124,7 +124,7 @@ Import a key pair #. To change its permissions so that only you can read and write to the file, run the following command: - .. code:: + .. code:: bash $ chmod 0600 yourPrivateKey.pem @@ -135,7 +135,7 @@ Import a key pair #. To make the key pair known to SSH, run the **ssh-add** command. - .. code:: + .. code:: bash $ ssh-add yourPrivateKey.pem diff --git a/doc/source/create_and_manage_databases.rst b/doc/source/create_and_manage_databases.rst index 99364cb8..c20ecbb8 100644 --- a/doc/source/create_and_manage_databases.rst +++ b/doc/source/create_and_manage_databases.rst @@ -24,7 +24,7 @@ flavor for the type of database instance you want. #. Add the following line to ``/etc/trove/trove.conf``: - .. code:: + .. code:: ini default_datastore = DATASTORE_NAME @@ -36,13 +36,13 @@ flavor for the type of database instance you want. For example, if your MySQL datastore name is set to ``mysql``, your entry would look like this: - .. code:: + .. code:: ini default_datastore = mysql #. Restart Database services on the controller node: - .. code:: + .. code:: bash # service trove-api restart # service trove-taskmanager restart diff --git a/doc/source/index.rst b/doc/source/index.rst index 620f429a..df268faf 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,8 +1,4 @@ -.. os-doc-demo documentation master file, created by - sphinx-quickstart on Tue Jan 20 08:22:27 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - +================== Demo documentation ================== @@ -21,6 +17,18 @@ Here's an example configuration:: vncserver_proxyclient_address = 10.0.0.31 novncproxy_base_url = http://controller:6080/vnc_auto.html +Here's the same example but with ..code: ini to test the pygments lexer: + +.. code:: ini + + [DEFAULT] + ... + my_ip = 10.0.0.31 + vnc_enabled = True + vncserver_listen = 0.0.0.0 + vncserver_proxyclient_address = 10.0.0.31 + novncproxy_base_url = http://controller:6080/vnc_auto.html + .. note:: Here's an example note. .. toctree:: diff --git a/openstackdocstheme/__init__.py b/openstackdocstheme/__init__.py index 206119f4..d5554fa2 100644 --- a/openstackdocstheme/__init__.py +++ b/openstackdocstheme/__init__.py @@ -15,7 +15,29 @@ import os +def builder_inited(app): + theme_dir = os.path.join(os.path.dirname(__file__), 'theme') + app.info('Using openstackdocstheme Sphinx theme from %s' % theme_dir) + # Insert our theme directory at the front of the search path and + # force the theme setting to use the one in the package. This is + # done here, instead of in setup(), because conf.py is read after + # setup() runs, so if the conf contains these values the user + # values overwrite these. That's not bad for the theme, but it + # breaks the search path. + app.config.html_theme_path.insert(0, theme_dir) + # Set the theme name + app.config.html_theme = 'openstackdocstheme' + # Re-initialize the builder, if it has the method for setting up + # the templates and theme. + if hasattr(app.builder, 'init_templates'): + app.builder.init_templates() + + def get_html_theme_path(): - """Return the directory containing our HTML theme.""" + """Return the directory containing HTML theme for local builds.""" pkg_dir = os.path.abspath(os.path.dirname(__file__)) return os.path.join(pkg_dir, 'theme') + + +def setup(app): + app.connect('builder-inited', builder_inited)