From 7846896156da7ec45a3a3f5566b2a12c8ed3472b Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 13 Jun 2022 12:41:33 +0200 Subject: gnu: Add js-mathjax-for-r-mathjaxr. * gnu/packages/patches/mathjax-3.1.2-no-a11y.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/javascript.scm (js-mathjax-for-r-mathjaxr): New variable. --- gnu/packages/javascript.scm | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'gnu/packages/javascript.scm') diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm index 028b5c4391..5598341e5c 100644 --- a/gnu/packages/javascript.scm +++ b/gnu/packages/javascript.scm @@ -313,6 +313,63 @@ be able to view it naturally and easily."))) (description (package-description js-mathjax)) (license license:asl2.0))) +(define-public js-mathjax-for-r-mathjaxr + (package + (inherit js-mathjax-3) + (name "js-mathjax") + (version "3.1.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mathjax/MathJax-src") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0kqcb6pl0zfs4hf8zqb4l50kkfq7isv35vpy05m0lg0yr9w0w4ai")) + (patches (search-patches "mathjax-disable-webpack.patch" + "mathjax-3.1.2-no-a11y.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments js-mathjax-3) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (replace 'prepare-sources + (lambda* (#:key inputs #:allow-other-keys) + ;; All a11y components depend on speech-rule-engine, which cannot be + ;; built from source. Since this only affects accessibility, remove them. + (delete-file-recursively "ts/a11y") + (delete-file-recursively "components/src/a11y") + (delete-file-recursively "components/src/sre") + (delete-file-recursively "components/src/node-main") + + ;; Copy sources of dependencies, so we can create symlinks. + (mkdir-p "node_modules") + (with-directory-excursion "node_modules" + (for-each + (lambda (p) + (copy-recursively (assoc-ref inputs (string-append "node-" p)) p)) + '("mj-context-menu"))) + + ;; Make sure esbuild can find imports. This way we don’t have to rewrite files. + (symlink "ts" "js") + (symlink "ts" "node_modules/mj-context-menu/js"))))))) + (native-inputs + `(("esbuild" ,esbuild) + ("node" ,node-lts) + ("node-mj-context-menu" + ,(let ((name "context-menu") + (version "0.6.1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zorkow/context-menu.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))))))) + (define-public js-commander (package (name "js-commander") -- cgit v1.2.3