From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: convert rmarkdown (rmd) files to orgmode? Date: Thu, 21 Jul 2016 09:48:55 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c07c18a3405ce05381fb6c7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ7n0-000221-Jf for emacs-orgmode@gnu.org; Thu, 21 Jul 2016 02:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQ7my-0005aK-Gj for emacs-orgmode@gnu.org; Thu, 21 Jul 2016 02:48:57 -0400 Received: from mail-yw0-x22d.google.com ([2607:f8b0:4002:c05::22d]:34576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ7my-0005aG-Ak for emacs-orgmode@gnu.org; Thu, 21 Jul 2016 02:48:56 -0400 Received: by mail-yw0-x22d.google.com with SMTP id z8so44508174ywa.1 for ; Wed, 20 Jul 2016 23:48:55 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" Cc: org mode , Philip Hudson --94eb2c07c18a3405ce05381fb6c7 Content-Type: text/plain; charset=UTF-8 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 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 > 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 >> > > --94eb2c07c18a3405ce05381fb6c7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi again

Chuck:

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


=C2=A0#+BEGIN_EXAMPLE
=C2=A0 =C2=A0 =C2= =A0help.search("rnorm")
=C2=A0#+END_EXAMPLE
=

will turn into R blocks=C2=A0

=
=C2=A0#+BEGIN_SRC R :session Rorg =C2=A0:results none
= =C2=A0 =C2=A0 =C2=A0help.search("rnorm")
#+END_SRC<= /div>


thx!

Z







=
On Wed, Jul 20, 2016 at 9:00 PM, Xebar Saram <z= eltakc@gmail.com> 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 abo= ut 50 of these converted Rmd to org files :)
ill keep investigati= ng this and report back

thx so much for the tips! = :)

Z

On Wed, J= ul 20, 2016 at 8:42 PM, Charles C. Berry <ccberry@ucsd.edu> w= rote:
On Wed, 20 Jul 2016, Xebar Sa= ram wrote:

thx for the tips!

when i try to run the source block :

#+BEGIN_SRC emacs-lisp :results silent
=C2=A0(replace-regexp "^=3D[{]r \\([^}]*\\)[}]\\(.*\\)=3D$"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"#+name:= \\1
=C2=A0,#+begin_src R
=C2=A0\\2
=C2=A0,#+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 insi= de equal signs like

: =3D{r my-name} code =3D

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


--94eb2c07c18a3405ce05381fb6c7--