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.
This commit is contained in:
Ricardo Wurmus 2022-06-13 12:41:33 +02:00
parent 97ebfc8f5c
commit 7846896156
No known key found for this signature in database
GPG key ID: 197A5888235FACAC
3 changed files with 339 additions and 0 deletions

View file

@ -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 dont 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")