diff --git a/scripts/make_docs.py b/scripts/make_docs.py index efbbf8802..5d5656ab1 100644 --- a/scripts/make_docs.py +++ b/scripts/make_docs.py @@ -1,7 +1,8 @@ #!/usr/bin/python +# encoding: utf-8 # # Ceres Solver - A fast non-linear least squares minimizer -# Copyright 2013 Google Inc. All rights reserved. +# Copyright 2014 Google Inc. All rights reserved. # http://code.google.com/p/ceres-solver/ # # Redistribution and use in source and binary forms, with or without @@ -40,42 +41,76 @@ import sys N = len(sys.argv) if N < 3: - print "make_docs.py src_root destination_root" + print 'make_docs.py src_root destination_root' sys.exit(1) -src_dir = sys.argv[1] + "/docs/source" +src_dir = sys.argv[1] + '/docs/source' build_root = sys.argv[2] -cache_dir = build_root + "/doctrees" -html_dir = build_root + "/html" +cache_dir = build_root + '/doctrees' +html_dir = build_root + '/html' # Called from Command Line if N == 3: - sphinx_exe = "sphinx-build" + sphinx_exe = 'sphinx-build' # Called from CMake (using the SPHINX_EXECUTABLE found) elif N == 4: sphinx_exe = sys.argv[3] # Run Sphinx to build the documentation. -os.system("%s -b html -d %s %s %s" %(sphinx_exe, cache_dir, src_dir, html_dir)) +os.system('%s -b html -d %s %s %s' %(sphinx_exe, cache_dir, src_dir, html_dir)) -input_pattern = """config=TeX-AMS-MML_HTMLorMML">""" -output_pattern = """config=TeX-AMS_HTML"> - MathJax.Hub.Config({ - "HTML-CSS": { - availableFonts: ["TeX"] - } - }); -""" +replacements = [ + # By default MathJax uses does not use TeX fonts. This simple search + # and replace fixes that. + ('''config=TeX-AMS-MML_HTMLorMML">''', + '''config=TeX-AMS_HTML"> + MathJax.Hub.Config({ + "HTML-CSS": { + availableFonts: ["TeX"] + } + }); + '''), -# By default MathJax uses does not use TeX fonts. This simple search -# and replace fixes that. -for name in glob.glob("%s/*.html" % html_dir): - print "Postprocessing: ", name - fptr = open(name) - out = fptr.read().replace(input_pattern, output_pattern) - fptr.close() + # The title for the homepage is not ideal, so change it. + ('