gnu: Add r-prettydoc.

* gnu/packages/cran.scm (r-prettydoc): New variable.
This commit is contained in:
Ricardo Wurmus 2023-03-30 13:55:17 +02:00
parent 2f9b2699b1
commit 884daf0f4b
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -1025,6 +1025,71 @@ (define-public r-pma
canonical correlation analysis.")
(license license:gpl2+)))
(define-public r-prettydoc
(package
(name "r-prettydoc")
(version "0.4.1")
(source (origin
(method url-fetch)
(uri (cran-uri "prettydoc" version))
(sha256
(base32
"0aa89jnqhz0l69inrgm1f1riq5bm3ksb8wjl8d4x2f320adsd50h"))
(snippet
'(for-each delete-file
'("inst/resources/js/auto-render.min.js"
"inst/resources/js/katex.min.js")))))
(properties `((upstream-name . "prettydoc")))
(build-system r-build-system)
(arguments
`(#:modules ((guix build utils)
(guix build r-build-system)
(srfi srfi-1))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'process-javascript
(lambda* (#:key inputs #:allow-other-keys)
(with-directory-excursion "inst/resources/js/"
(call-with-values
(lambda ()
(unzip2
`((,(search-input-file inputs "dist/katex.js")
"katex.min.js")
(,(search-input-file inputs "dist/contrib/auto-render.js")
"auto-render.min.js"))))
(lambda (sources targets)
(for-each (lambda (source target)
(format #true "Processing ~a --> ~a~%"
source target)
(invoke "esbuild" source "--minify"
(string-append "--outfile=" target)))
sources targets)))))))))
(inputs (list pandoc))
(propagated-inputs (list r-rmarkdown))
(native-inputs
(list esbuild
r-knitr
r-rmarkdown
(let ((version "0.12.0"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/KaTeX/KaTeX")
(commit (string-append "v" version))))
(file-name (git-file-name "js-katex" version))
(sha256
(base32
"0pdfw28affnfpqpnf244acf5rkxdy2gk63669myy7ysg4z0i1n8j"))))))
(home-page "https://github.com/yixuan/prettydoc")
(synopsis "Create pretty documents from R markdown")
(description
"This is a package for creating tiny yet beautiful documents and
vignettes from R Markdown. The package provides the @code{html_pretty} output
format as an alternative to the @code{html_document} and @code{html_vignette}
engines that convert R Markdown into HTML pages. Various themes and syntax
highlight styles are supported.")
(license license:asl2.0)))
(define-public r-proj4
(package
(name "r-proj4")