Skip to content

Commit

Permalink
gh-36098: Detect and use system MathJax-3.x
Browse files Browse the repository at this point in the history
    
Resolves #30296
    
URL: #36098
Reported by: Michael Orlitzky
Reviewer(s): Kwankyu Lee, Michael Orlitzky
  • Loading branch information
Release Manager committed Aug 26, 2023
2 parents 48ef6df + ab1649c commit a3e6bb2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions build/pkgs/mathjax/distros/gentoo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
>=dev-libs/mathjax-3
26 changes: 26 additions & 0 deletions build/pkgs/mathjax/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SAGE_SPKG_CONFIGURE([mathjax], [
# Arch: /usr/share/mathjax
# Gentoo: /usr/share/mathjax
# Void: /usr/share/mathjax
AC_MSG_CHECKING([for MathJax-3.x])
m4_foreach([mathjax_dir], [/usr/share/mathjax], [
# tex-chtml.hs is used in src/sage_docbuild/conf.py
# and was not present in MathJax-2.x
AS_IF([test -f "mathjax_dir/tex-chtml.js"], [
SAGE_MATHJAX_DIR="mathjax_dir"
AC_MSG_RESULT([mathjax_dir])
])
])
AS_IF([test -z "${SAGE_MATHJAX_DIR}"], [
AC_MSG_RESULT([no])
sage_spkg_install_mathjax=yes
])
],[],[],[
# post-check
AS_IF([test x$sage_spkg_install_mathjax = xyes], [
# Our spkg-src script adds an extra "mathjax"
SAGE_MATHJAX_DIR='${prefix}'/share/mathjax/mathjax
])
AC_SUBST(SAGE_MATHJAX_DIR, "${SAGE_MATHJAX_DIR}")
])
2 changes: 1 addition & 1 deletion pkgs/sage-conf/_sage_conf/_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SAGE_ARCHFLAGS = "@SAGE_ARCHFLAGS@"
SAGE_PKG_CONFIG_PATH = "@SAGE_PKG_CONFIG_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)

# Used in sage.repl.ipython_kernel.install
MATHJAX_DIR = SAGE_LOCAL + "/share/mathjax"
MATHJAX_DIR = "@SAGE_MATHJAX_DIR@".replace('${prefix}', SAGE_LOCAL)
THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"

# OpenMP flags, if available.
Expand Down
3 changes: 1 addition & 2 deletions src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ def set_intersphinx_mappings(app, config):
if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes':
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
else:
mathjax_path = 'mathjax/tex-chtml.js'
html_common_static_path += [MATHJAX_DIR]
mathjax_path = os.path.join(MATHJAX_DIR, 'tex-chtml.js')

# A list of glob-style patterns that should be excluded when looking for source
# files. They are matched against the source file names relative to the
Expand Down

0 comments on commit a3e6bb2

Please sign in to comment.