Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Remove handling of broken option SAGE_DOC_MATHJAX=no
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Nov 29, 2021
1 parent cc60cfe commit ef2b25b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 65 deletions.
9 changes: 4 additions & 5 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,11 @@ doc-html: sagemath_doc_html
doc-html-no-plot: doc-clean
+$(MAKE_REC) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-plot" doc-html

# Using mathjax is actually the default, but this target can be used
# to override an environment setting of SAGE_DOC_MATHJAX=no
doc-html-mathjax:
+$(MAKE_REC) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) -j" doc-html
# Using mathjax is actually the only options, but we keep
# this target for backwards compatibility.
doc-html-mathjax: doc-html

# Keep target 'doc-html-jsmath' for backwards compatibility.
# Also Keep target 'doc-html-jsmath' for backwards compatibility.
doc-html-jsmath: doc-html-mathjax

doc-pdf: sagemath_doc_pdf
Expand Down
14 changes: 0 additions & 14 deletions build/pkgs/sagemath_doc_html/spkg-install
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
#! /usr/bin/env bash

# When building documentation, use MathJax by default. To turn it off,
# set SAGE_DOC_MATHJAX to be "no" or "False".
if [ -z "$SAGE_DOC_MATHJAX" ]; then
# For backwards compatibility, we use the value of SAGE_DOC_JSMATH
# if it is set.
if [ -n "$SAGE_DOC_JSMATH" ]; then
SAGE_DOC_MATHJAX="$SAGE_DOC_JSMATH"
else
SAGE_DOC_MATHJAX="True"
fi
export SAGE_DOC_MATHJAX
fi

cd $SAGE_ROOT/src/doc
$MAKE doc-html
4 changes: 0 additions & 4 deletions build/pkgs/sagemath_doc_pdf/spkg-install
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#! /usr/bin/env bash
# This must be set; otherwise, sage.docs.conf uses sphinx.ext.imgmath,
# which leads to errors.
export SAGE_DOC_MATHJAX=yes

cd $SAGE_ROOT/src/doc
$MAKE doc-pdf
8 changes: 0 additions & 8 deletions src/doc/en/installation/source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1182,14 +1182,6 @@ Here are some of the more commonly used variables affecting the build process:
Some spkgs might also assume that certain programs are available on the
system (for example, ``latex`` or ``pdflatex``).

- :envvar:`SAGE_DOC_MATHJAX` - by default, any LaTeX code in Sage's
documentation is processed by MathJax.
If this variable is set to ``no``, then MathJax is not used -- instead,
math is processed using LaTeX and converted by dvipng to image files,
and then those files are included into the documentation.
Typically, building the documentation using LaTeX and dvipng takes longer
and uses more memory and disk space than using MathJax.

- :envvar:`SAGE_DOCBUILD_OPTS` - the value of this variable is passed as an
argument to ``sage --docbuild all html`` or ``sage --docbuild all pdf`` when
you run ``make``, ``make doc``, or ``make doc-pdf``.
Expand Down
33 changes: 12 additions & 21 deletions src/sage/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,21 @@ def set_intersphinx_mappings(app, config):
html_common_static_path = [os.path.join(SAGE_DOC_SRC, 'common', 'static'),
THEBE_DIR, 'static']

# We use MathJax to build the documentation unless the environment
# variable SAGE_DOC_MATHJAX is set to "no" or "False". (Note that if
# the user does not set this variable, then the script sage-env sets
# it to "True".)
# We use MathJax to build the documentation.
extensions.append('sphinx.ext.mathjax')
mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js'

if (os.environ.get('SAGE_DOC_MATHJAX', 'no') not in ['no', 'False']):
extensions.append('sphinx.ext.mathjax')
mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js'
from sage.misc.latex_macros import sage_mathjax_macros
html_theme_options['mathjax_macros'] = sage_mathjax_macros()

from sage.misc.latex_macros import sage_mathjax_macros
html_theme_options['mathjax_macros'] = sage_mathjax_macros()

mathjax_relative = os.path.basename(MATHJAX_DIR)

# It would be really nice if sphinx would copy the entire mathjax
# directory, (so we could have a _static/mathjax directory), rather than
# the contents of the directory

html_common_static_path.append(MATHJAX_DIR)
exclude_patterns += ['**/'+os.path.join(mathjax_relative, i)
for i in ('docs', 'README*', 'test', 'unpacked', 'LICENSE')]
else:
extensions.append('sphinx.ext.imgmath')
mathjax_relative = os.path.basename(MATHJAX_DIR)

# It would be really nice if sphinx would copy the entire mathjax
# directory, (so we could have a _static/mathjax directory), rather than
# the contents of the directory
html_common_static_path.append(MATHJAX_DIR)
exclude_patterns += ['**/' + os.path.join(mathjax_relative, i)
for i in ('docs', 'README*', 'test', 'unpacked', 'LICENSE')]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/sagedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ def _open(self, name, testing=False):
path = os.path.join(self._base_path, name, "index.html")
if not os.path.exists(path):
raise OSError("""The document '{0}' does not exist. Please build it
with 'sage -docbuild {0} html --mathjax' and try again.""".format(name))
with 'sage -docbuild {0} html' and try again.""".format(name))

if testing:
return (url, path)
Expand Down
15 changes: 3 additions & 12 deletions src/sage_docbuild/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,9 +1401,8 @@ def help_examples(s=""):
s += " sage --docbuild -FDC all\n"
s += " sage --docbuild constructions pdf\n"
s += " sage --docbuild reference html -jv3\n"
s += " sage --docbuild --mathjax tutorial html\n"
s += " sage --docbuild reference print_unincluded_modules\n"
s += " sage --docbuild developer -j html --sphinx-opts -q,-aE --verbose 2"
s += " sage --docbuild developer html --sphinx-opts -q,-aE --verbose 2"
return s

def get_documents():
Expand Down Expand Up @@ -1601,8 +1600,8 @@ def setup_parser():
help="include variables prefixed with '_' in reference manual; may be slow, may fail for PDF output")

standard.add_option("-j", "--mathjax", "--jsmath", dest="mathjax",
action="store_true",
help="render math using MathJax; FORMATs: html, json, pickle, web")
default=True, action="store_true",
help="ignored for backwards compatibility")
standard.add_option("--no-plot", dest="no_plot",
action="store_true",
help="do not include graphics auto-generated using the '.. plot' markup")
Expand Down Expand Up @@ -1769,14 +1768,6 @@ def excepthook(*exc_info):
sys.excepthook = excepthook

# Process selected options.
#
# MathJax: this check usually has no practical effect, since
# SAGE_DOC_MATHJAX is set to "True" by the script sage-env.
# To disable MathJax, set SAGE_DOC_MATHJAX to "no" or "False".
if options.mathjax or (os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'no'
and os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'False'):
os.environ['SAGE_DOC_MATHJAX'] = 'True'

if options.check_nested:
os.environ['SAGE_CHECK_NESTED'] = 'True'

Expand Down

0 comments on commit ef2b25b

Please sign in to comment.