Simplify documentation generation.
1. The MathJax font configuration is moved into conf.py and removed
from make_docs.py along with better font sizing.
2. Remove the bread crumb replacement as it is not working anymore.
3. Fix a parsing error in nnls_modeling.rst which the new version of
sphinx barfed on.
Change-Id: Ia3c2e732323a8b5cabafe851ac5ca0f0c82da071
diff --git a/docs/source/conf.py b/docs/source/conf.py
index c266746..c83468f 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -41,16 +41,16 @@
# General information about the project.
project = u'Ceres Solver'
-copyright = u'2018 Google Inc'
+copyright = u'2020 Google Inc'
# 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.
#
# The short X.Y version.
-version = '1.14'
+version = '2.0'
# The full version, including alpha/beta/rc tags.
-release = '1.14.0'
+release = '2.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -240,3 +240,15 @@
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
+
+# Custom configuration for MathJax.
+#
+# By default MathJax does not use TeX fonts, which is a tragedy. Also
+# scaling the fonts down a bit makes them fit better with font sizing
+# in the "Read The Docs" theme.
+mathjax_config = {
+'HTML-CSS' : {
+ 'availableFonts' : ["TeX"],
+ 'scale' : 90
+ }
+}
diff --git a/docs/source/nnls_modeling.rst b/docs/source/nnls_modeling.rst
index 1b7287f..0e8645d 100644
--- a/docs/source/nnls_modeling.rst
+++ b/docs/source/nnls_modeling.rst
@@ -1560,7 +1560,7 @@
.. class:: Problem::Options
- Options struct that is used to control :class:`Problem::`.
+ Options struct that is used to control :class:`Problem`.
.. member:: Ownership Problem::Options::cost_function_ownership
diff --git a/scripts/make_docs.py b/scripts/make_docs.py
index c1e711f..7d5c4cd 100644
--- a/scripts/make_docs.py
+++ b/scripts/make_docs.py
@@ -63,44 +63,11 @@
os.system('%s -b html -d %s %s %s' %(sphinx_exe, cache_dir, src_dir, html_dir))
replacements = [
- # By default MathJax uses does not use TeX fonts. This simple search
- # and replace fixes that.
- ('''config=TeX-AMS-MML_HTMLorMML"></script>''',
- '''config=TeX-AMS_HTML">
- MathJax.Hub.Config({
- "HTML-CSS": {
- availableFonts: ["TeX"]
- }
- });
- </script>'''),
-
# The title for the homepage is not ideal, so change it.
('<title>Ceres Solver — Ceres Solver</title>',
'<title>Ceres Solver — A Large Scale Non-linear Optimization Library</title>')
]
-# This is a nasty hack to strip the breadcrumb navigation. A better strategy is
-# to fork the upstream template, but that is no fun either. Whitespace matters!
-# This doesn't use regular expressions since the escaping makes it untenable.
-breadcrumb_start_other = \
-'''<div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="index.html">Docs</a> »</li>
-
- <li>'''
-
-# The index page has a slightly different breadcrumb.
-breadcrumb_start_index = breadcrumb_start_other.replace('index.html', '#')
-
-breadcrumb_end = \
-'''</li>
- <li class="wy-breadcrumbs-aside">
-
- </li>
- </ul>
- <hr/>
-</div>'''
-
for name in glob.glob('%s/*.html' % html_dir):
print('Postprocessing: ', name)
with io.open(name, encoding="utf-8") as fptr:
@@ -109,16 +76,5 @@
for input_pattern, output_pattern in replacements:
out = out.replace(input_pattern, output_pattern)
- try:
- breadcrumb_start = breadcrumb_start_index \
- if name.endswith('index.html') \
- else breadcrumb_start_other
- pre_breadcrumb_start, post_breadcrumb_start = out.split(breadcrumb_start)
- title, post_breadcrumb_end = post_breadcrumb_start.split(breadcrumb_end)
- print('Stripping breadcrumb for -', title)
- out = pre_breadcrumb_start + post_breadcrumb_end
- except ValueError:
- print('Skipping breadcrumb strip for', name)
-
with io.open(name, 'w', encoding="utf-8") as fptr:
fptr.write(out)