Newer
Older
# -*- mode: python -*-
# -*- coding: utf-8 -*-
# All configuration values have a default; values that are commented out
# serve to show the default.
from warnings import warn
import sphinx_bootstrap_theme
VERSION_STR_RE = re.compile(r'^\s*return "(\d+\.\d+\.(\d{8}\.\d{4}|\d+))";$')
def _version_string_from_cpp(filename):
vers_cpp_lines = open(filename, 'r').readlines()
version_str = '0.0.0'
for line in vers_cpp_lines:
match = VERSION_STR_RE.match(line.rstrip())
if match is not None:
version_str = match.group(1)
break
return version_str
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
# we use pngmath over mathjax so that the the offline help isn't reliant on
# anything external and we don't need to include the large mathjax package
'sphinx.ext.pngmath',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'MantidProject'
copyright = u'2007-2018, Mantid'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# This is read from Framework/Kernel/src/MantidVersion.cpp to avoid the requirement of having
# a built copy of mantid
version_cpp_path = os.path.relpath(os.path.join('..', '..', 'Framework',
'Kernel', 'src', 'MantidVersion.cpp'))
try:
version_str = _version_string_from_cpp(version_cpp_path)
except StandardError as ex:
warn("WARNING: Unable to parse version from MantidVersion: {}\nSetting version string to 0.0.0".format(str(ex)))
version_str = '0.0.0'
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# The short X.Y version.
version = ".".join(version_str.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = version_str
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for pngmath --------------------------------------------------
# Load the preview package into latex
pngmath_latex_preamble=r'\usepackage[active]{preview}'
# Ensures that the vertical alignment of equations is correct.
# See http://sphinx-doc.org/ext/math.html#confval-pngmath_use_preview
pngmath_use_preview = True
# -- HTML output ----------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'bootstrap'
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
# The "title" for HTML documentation generated with Sphinx' templates. This is appended to the <title> tag of individual pages
# and used in the navigation bar as the "topmost" element.
html_title = ""
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = os.path.relpath(os.path.join('..', '..', 'images', 'Mantid_Logo_Transparent.png'))
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
html_use_smartypants = True
# Hide the Sphinx usage as we reference it on github instead.
html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
html_show_copyright = False
# Theme-specific options to customize the look and feel of a theme.
# We config the bootstrap settings here, and apply CSS changes in
# custom.css rather than here.
html_theme_options = {
# Navigation bar title.
'navbar_title': " ", # deliberate single space so it's not visible
# Tab name for entire site.
'navbar_site_name': "Mantid",
# Add links to the nav bar. Third param of tuple is true to create absolute url.
'navbar_links': [
("Download", "http://download.mantidproject.org", True),
("Wiki", "http://www.mantidproject.org", True),
("User Documentation", "http://docs.mantidproject.org", True),
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
("Contact Us", "http://www.mantidproject.org/Contact", True),
],
# Do not show the "Show source" button.
'source_link_position': "no",
# Remove the local TOC from the nav bar
'navbar_pagenav': False,
# Hide the next/previous in the nav bar.
'navbar_sidebarrel': True,
# Use the latest version.
'bootstrap_version': "3",
# Ensure the nav bar always stays on top of page.
'navbar_fixed_top': "false",
}
# -- Options for Epub output ---------------------------------------------------
# This flag determines if a toc entry is inserted again at the beginning of its nested toc listing.
# This allows easier navigation to the top of a chapter, but can be confusing because it mixes entries of different depth in one list.
# The default value is True.
epub_tocdup = True
#This setting control the scope of the epub table of contents
epub_tocscope = 'includehidden'
#The author of the document. This is put in the Dublin Core metadata. The default value is 'unknown'.
epub_author = "The Mantid Project"
#The publisher of the document. This is put in the Dublin Core metadata. You may use any sensible string, e.g. the project homepage.
epub_publisher = "The Mantid Project"
#An identifier for the document. This is put in the Dublin Core metadata.
#For published documents this is the ISBN number, but you can also use an alternative scheme, e.g. the project homepage.
#The default value is 'unknown'.
epub_identifier = "www.mantidproject.org"
#The publication scheme for the epub_identifier. This is put in the Dublin Core metadata.
#For published books the scheme is 'ISBN'. If you use the project homepage, 'URL' seems reasonable.
#The default value is 'unknown'.
epub_scheme='URL'
#A unique identifier for the document. This is put in the Dublin Core metadata. You may use a random string.
#The default value is 'unknown'.
epub_uid = "Mantid Reference: " + version
# -- Link to other projects ----------------------------------------------------
intersphinx_mapping = {
'h5py': ('http://docs.h5py.org/en/latest/', None),
'matplotlib': ('http://matplotlib.org', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'python': ('https://docs.python.org/3/', None),
'SciPy': ('http://docs.scipy.org/doc/scipy/reference', None),
'mantid': ('http://docs.mantidproject.org/', None)
}