Codebase list oslo-sphinx / 7c282dc
Allow alternate OpenStack themes 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 Doug Hellmann 9 years ago
1 changed file(s) with 8 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818 theme_dir = os.path.join(os.path.dirname(__file__), 'theme')
1919 app.info('Using openstack theme from %s' % theme_dir)
2020 # Insert our theme directory at the front of the search path and
21 # force the theme setting to use the one in the package. This is
22 # done here, instead of in setup(), because conf.py is read after
23 # setup() runs, so if the conf contains these values the user
24 # values overwrite these. That's not bad for the theme, but it
25 # breaks the search path.
21 # force the theme setting to use the one in the package unless
22 # another openstack theme is already selected. This is done here,
23 # instead of in setup(), because conf.py is read after setup()
24 # runs, so if the conf contains these values the user values
25 # overwrite these. That's not bad for the theme, but it breaks the
26 # search path.
2627 app.config.html_theme_path.insert(0, theme_dir)
2728 # Set the theme name
28 app.config.html_theme = 'openstack'
29 if not app.config.html_theme.startswith('openstack'):
30 app.config.html_theme = 'openstack'
2931 # Re-initialize the builder, if it has the method for setting up
3032 # the templates and theme.
3133 if hasattr(app.builder, 'init_templates'):