diff options
author | Doug Hellmann <doug@doughellmann.com> | 2015-01-26 17:10:43 -0500 |
---|---|---|
committer | Doug Hellmann <doug@doughellmann.com> | 2015-01-26 17:10:43 -0500 |
commit | 7c282dc14a0c7a718a2f477e958822e4cf186d2a (patch) | |
tree | 201645491d5321e0e3a1564b21658b07f59a25c2 | |
parent | f640b5e3f8b374892645549693bb557efdc448db (diff) | |
download | oslosphinx-7c282dc14a0c7a718a2f477e958822e4cf186d2a.tar.gz |
Allow alternate OpenStack themes2.4.0
By default oslosphinx forces projects that use it to use the theme
contained in the package. The documentation team wants to provide a
separate theme for some parts of the docs.openstack.org site. They are
going to distribute it in their own package, but do still want to be
able to use other features of oslosphinx. This change allows any name
that starts "openstack" to be used, while retaining the default behavior
of inserting the "openstack" theme if a project is using a different
default or has not set a theme.
Change-Id: I7a2c5a5c3805685b8fa0baaa47393d5fec312f30
-rw-r--r-- | oslosphinx/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/oslosphinx/__init__.py b/oslosphinx/__init__.py index 08224b4..4a238c0 100644 --- a/oslosphinx/__init__.py +++ b/oslosphinx/__init__.py @@ -19,14 +19,16 @@ def builder_inited(app): theme_dir = os.path.join(os.path.dirname(__file__), 'theme') app.info('Using openstack 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. + # force the theme setting to use the one in the package unless + # another openstack theme is already selected. 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 = 'openstack' + if not app.config.html_theme.startswith('openstack'): + app.config.html_theme = 'openstack' # Re-initialize the builder, if it has the method for setting up # the templates and theme. if hasattr(app.builder, 'init_templates'): |