emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] convert rmarkdown (rmd) files to orgmode?


From: Xebar Saram
Subject: Re: [O] convert rmarkdown (rmd) files to orgmode?
Date: Thu, 21 Jul 2016 09:48:55 +0300

Hi again

Chuck:

is there a way to modify you nice code regex code snippet to simultaneously change all example blocks to R blocks in a converted rmd>org file?
so when executing the block all example blocks:


 #+BEGIN_EXAMPLE
     help.search("rnorm")
 #+END_EXAMPLE

will turn into R blocks 

 #+BEGIN_SRC R :session Rorg  :results none
     help.search("rnorm")
#+END_SRC


thx!

Z








On Wed, Jul 20, 2016 at 9:00 PM, Xebar Saram <address@hidden> wrote:
ahh i see what you mean.

thats a cool tip yet i find i have to find/replace also for images, find/replace to change example blocks to R code blocks etc which is quite tedious since i have about 50 of these converted Rmd to org files :)
ill keep investigating this and report back

thx so much for the tips! :)

Z

On Wed, Jul 20, 2016 at 8:42 PM, Charles C. Berry <address@hidden> wrote:
On Wed, 20 Jul 2016, Xebar Saram wrote:

thx for the tips!

when i try to run the source block :

#+BEGIN_SRC emacs-lisp :results silent
 (replace-regexp "^=[{]r \\([^}]*\\)[}]\\(.*\\)=$"
                 "#+name: \\1
 ,#+begin_src R
 \\2
 ,#+end_src")

#+END_SRC

i just get a nil in the message area. what am i missing?



Nothing!

The `:results silent' should suppress any output.

Anyway, what you should see is that the code chunks that pandoc placed inside equal signs like

: ={r my-name} code =

are now in src blocks.

I think you need to put the src block at the top or add a

: (goto-char (point-min))

as its first line to be sure it converts all the code chunks.


Chuck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]