diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 764d29f22..3e8cad8d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,8 +49,12 @@ build_doc: stage: build script: - meson rewrite kwargs set project / version "$VERSION" - - meson setup -Dbuild_for=octave build-doc + # Use a local copy of MathJax to avoid using CDN (which are a privacy issue) + # NB: Debian 12 “Bookworm” has MathJax 2. The following needs to be updated + # when Debian moves to MathJax 3. + - meson setup -Dbuild_for=octave -Dmathjax_path=mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML build-doc - meson compile -v -C build-doc doc + - cp -dR /usr/share/javascript/mathjax build-doc/dynare-manual.html/_static/ artifacts: paths: - build-doc/ @@ -60,7 +64,6 @@ pkg_source: stage: pkg script: - meson rewrite kwargs set project / version "$VERSION" - - rm doc/manual/source/_static/mathjax && sed -i "/^mathjax_path *=/d" doc/manual/source/conf.py - git commit -a -m "Source for $VERSION" - meson setup -Dbuild_for=octave build-src - meson dist -C build-src --no-tests @@ -204,8 +207,6 @@ deploy_manual_unstable: dependencies: - build_doc script: - - rm -rf build-doc/dynare-manual.html/_static/mathjax - - ln -s /usr/share/javascript/mathjax build-doc/dynare-manual.html/_static/mathjax - rsync --recursive --links --delete build-doc/dynare-manual.html/ /srv/www.dynare.org/manual-unstable/ deploy_snapshot_unstable: diff --git a/doc/manual/source/_static/mathjax b/doc/manual/source/_static/mathjax deleted file mode 120000 index 871cc0900..000000000 --- a/doc/manual/source/_static/mathjax +++ /dev/null @@ -1 +0,0 @@ -/usr/share/javascript/mathjax/ \ No newline at end of file diff --git a/doc/manual/source/conf.py b/doc/manual/source/conf.py index 4aaae397d..861842041 100644 --- a/doc/manual/source/conf.py +++ b/doc/manual/source/conf.py @@ -31,8 +31,6 @@ templates_path = ['_templates'] html_static_path = ['_static'] -mathjax_path = 'mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML' - master_doc = 'index' project = u'Dynare' diff --git a/meson.build b/meson.build index f87b5a2d4..41748b149 100644 --- a/meson.build +++ b/meson.build @@ -552,6 +552,10 @@ sphinx_src = [ 'doc/manual/source/conf.py', sphinx_defines = [ '-D', 'release=' + meson.project_version(), '-D', 'version=' + meson.project_version() ] +if get_option('mathjax_path') != '' + sphinx_defines += [ '-D', 'mathjax_path=' + get_option('mathjax_path') ] +endif + dynare_manual_html = custom_target('dynare-manual.html', output : 'dynare-manual.html', input : sphinx_src, command : [ sphinx_build_exe, '-b', 'html', sphinx_defines, diff --git a/meson_options.txt b/meson_options.txt index 9f13132c8..cb8fc8df1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ # TODO: Rename this file to meson.options when meson ⩾ 1.1 is required option('build_for', type : 'combo', choices : [ 'matlab', 'octave' ], description : 'Whether to build for MATLAB or Octave') option('matlab_path', type : 'string', description : 'Absolute directory containing the MATLAB installation') +option('mathjax_path', type : 'string', description : 'Path to the MathJax JavaScript file to include in the HTML documentation produced by Sphinx; leave empty to use the default CDN')