Skip to content

Commit a3e6bb2

Browse files
author
Release Manager
committed
gh-36098: Detect and use system MathJax-3.x Resolves #30296 URL: #36098 Reported by: Michael Orlitzky Reviewer(s): Kwankyu Lee, Michael Orlitzky
2 parents 48ef6df + ab1649c commit a3e6bb2

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

build/pkgs/mathjax/distros/gentoo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
>=dev-libs/mathjax-3

build/pkgs/mathjax/spkg-configure.m4

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
SAGE_SPKG_CONFIGURE([mathjax], [
2+
# Arch: /usr/share/mathjax
3+
# Gentoo: /usr/share/mathjax
4+
# Void: /usr/share/mathjax
5+
AC_MSG_CHECKING([for MathJax-3.x])
6+
m4_foreach([mathjax_dir], [/usr/share/mathjax], [
7+
# tex-chtml.hs is used in src/sage_docbuild/conf.py
8+
# and was not present in MathJax-2.x
9+
AS_IF([test -f "mathjax_dir/tex-chtml.js"], [
10+
SAGE_MATHJAX_DIR="mathjax_dir"
11+
AC_MSG_RESULT([mathjax_dir])
12+
])
13+
])
14+
AS_IF([test -z "${SAGE_MATHJAX_DIR}"], [
15+
AC_MSG_RESULT([no])
16+
sage_spkg_install_mathjax=yes
17+
])
18+
],[],[],[
19+
# post-check
20+
AS_IF([test x$sage_spkg_install_mathjax = xyes], [
21+
# Our spkg-src script adds an extra "mathjax"
22+
SAGE_MATHJAX_DIR='${prefix}'/share/mathjax/mathjax
23+
])
24+
25+
AC_SUBST(SAGE_MATHJAX_DIR, "${SAGE_MATHJAX_DIR}")
26+
])

pkgs/sage-conf/_sage_conf/_conf.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ SAGE_ARCHFLAGS = "@SAGE_ARCHFLAGS@"
5050
SAGE_PKG_CONFIG_PATH = "@SAGE_PKG_CONFIG_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
5151

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

5656
# OpenMP flags, if available.

src/sage_docbuild/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ def set_intersphinx_mappings(app, config):
374374
if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes':
375375
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
376376
else:
377-
mathjax_path = 'mathjax/tex-chtml.js'
378-
html_common_static_path += [MATHJAX_DIR]
377+
mathjax_path = os.path.join(MATHJAX_DIR, 'tex-chtml.js')
379378

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

0 commit comments

Comments
 (0)