Fix the incorrect git source url

Documentation not located in 'doc/source' directory needs the
giturl value to make the source url correct.

Change-Id: I772a66de4680ba73ed79f8ea5481d6900f71fa82
Closes-Bug: #1732630
This commit is contained in:
chenxing 2017-12-14 17:59:46 +08:00
parent e998c5407d
commit f0744a1675
3 changed files with 14 additions and 1 deletions

View File

@ -78,6 +78,14 @@ Using the theme
bug_project = '721'
bug_tag = ''
#. Set the specific Git URL.
``giturl``
The path to the ``source`` directory of the documentation at ``git.openstack.org``.
If the documentation doesn't locate in ``doc/source`` directory, this option should
be set. Otherwise, the default is
``https://git.openstack.org/cgit/openstack/PROJECT_NAME/tree/doc/source/``.
#. Enable the "last-updated" information by setting the format for the
timestamp::

View File

@ -101,8 +101,11 @@ def _html_page_context(app, pagename, templatename, context, doctree):
app.warn('Cannot get gitsha from git repository.')
_html_context_data['gitsha'] = 'unknown'
giturl = app.config.giturl
repo_name = app.config.repository_name
if repo_name:
if giturl:
_html_context_data['giturl'] = app.config.giturl
elif repo_name:
_html_context_data['giturl'] = _giturl.format(repo_name)
bug_project = app.config.bug_project
if bug_project:
@ -124,6 +127,7 @@ def setup(app):
app.add_config_value('repository_name', '', 'env')
app.add_config_value('bug_project', '', 'env')
app.add_config_value('bug_tag', '', 'env')
app.add_config_value('giturl', '', 'env')
app.add_html_theme(
'openstackdocs',
os.path.abspath(os.path.dirname(__file__)) + '/theme/openstackdocs',

View File

@ -54,6 +54,7 @@ master_doc = 'index'
# General information about the project.
project = u'OpenStackdocstheme Release Notes'
copyright = u'2017, OpenStack Documentation team'
giturl = u'https://git.openstack.org/cgit/openstack/openstackdocstheme/tree/releasenotes/source'
# Release notes are version independent.
# The full version, including alpha/beta/rc tags.