diff mbox series

[bug#61838,v2,01/13] gnu: Add r-simplermarkdown.

Message ID 20230227204249.1906-1-madalinionel.patrascu@mdc-berlin.de
State New
Headers show
Series [bug#61838,v2,01/13] gnu: Add r-simplermarkdown. | expand

Commit Message

Mădălin Ionel Patrașcu Feb. 27, 2023, 8:42 p.m. UTC
* gnu/packages/cran.scm (r-simplermarkdown): New variable.
---
 gnu/packages/cran.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)


base-commit: 4db367f8ae4e704784ced52b552437ca00b94b89

Comments

Ricardo Wurmus March 1, 2023, 11:07 a.m. UTC | #1
Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de> writes:

> * gnu/packages/cran.scm (r-simplermarkdown): New variable.

Thanks for the update.

Turns out we cannot easily patch references to the pandoc executable.  I
tried this:

--8<---------------cut here---------------start------------->8---
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-pandoc-invocations
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((pandoc (search-input-file inputs "/bin/pandoc")))
                (substitute* '("R/mdtangle.R"
                               "R/mdweave.R"
                               "R/mdweave_to.R")
                  (("'pandoc ")
                   (string-append "'" pandoc " ")))
                (substitute* "R/has_pandoc.R"
                  (("Sys.which\\(\"pandoc\"\\)")
                   (string-append "\"" pandoc "\"")))))))))
--8<---------------cut here---------------end--------------->8---

This works, but the resulting output no longer has any references to
/gnu/store/…-pandoc…/bin/pandoc.  That’s because none of these files
make it to the output.  Instead they all seemingly get squished into a
pair of simplermarkdown.rdx and .rdb files, which are compressed.

So it is safer to propagate pandoc.
This may point to a general problem with the r-build-system that we may
need to investigate later.
diff mbox series

Patch

diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index c80e98134a..965b10c3a5 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -9652,6 +9652,30 @@  (define-public r-signal
 It also includes interpolation functions.")
     (license license:gpl2)))
 
+(define-public r-simplermarkdown
+  (package
+    (name "r-simplermarkdown")
+    (version "0.0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (cran-uri "simplermarkdown" version))
+       (sha256
+        (base32 "069pgx5m22rdqa21lyn5zqm9ym3g7w6z1d2wjwms8b1f2cp6266g"))))
+    (properties `((upstream-name . "simplermarkdown")))
+    (build-system r-build-system)
+    (propagated-inputs
+     (list pandoc
+           r-rjson))
+    (home-page "https://github.com/djvanderlaan/simplermarkdown")
+    (synopsis "Simple engine for generating reports using R")
+    (description
+     "This package runs R-code present in a pandoc markdown file and includes the
+resulting output in the resulting markdown file.  This file can then be converted
+into any of the output formats supported by pandoc.  The package can also be used
+as an engine for writing package vignettes.")
+    (license license:gpl3+)))
+
 (define-public r-gsubfn
   (package
     (name "r-gsubfn")