emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xebar Saram <zeltakc@gmail.com>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: org mode <emacs-orgmode@gnu.org>, Philip Hudson <phil.hudson@iname.com>
Subject: Re: convert rmarkdown (rmd) files to orgmode?
Date: Wed, 20 Jul 2016 20:29:32 +0300	[thread overview]
Message-ID: <CAOQHXPok-uQWZwo_iU5fPchsrrrjo8nXtsv2wQ1-8fepZFV4nw@mail.gmail.com> (raw)
In-Reply-To: <alpine.OSX.2.20.1607200956080.624@charles-berrys-macbook.local>

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

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?

thx

Z

On Wed, Jul 20, 2016 at 8:20 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:

> On Wed, 20 Jul 2016, Xebar Saram wrote:
>
> thx phil
>>
>> the Rmd format is actually quite different than md so that conversion
>> didnt
>> go well
>>
>>
> I tried this
>
>         pandoc -f markdown -t org input-file.Rmd -o output-file.org
>
> then I opened `output-file.org' and put this src block at the very top:
>
> #+BEGIN_SRC emacs-lisp :results silent
>   (replace-regexp "^=[{]r \\([^}]*\\)[}]\\(.*\\)=$"
>                   "#+name: \\1
>   ,#+begin_src R
>   \\2
>   ,#+end_src")
>
> #+END_SRC
>
> When I execute that code block, all the converted code chunks become src
> blocks.
>
> This isn't perfect as chunk options are appended to the `#+NAME:...' line,
> but if you want to play with the regexp's you can probably get it to pick
> those out and put them on a separate line. Or just write another src block
> with another `replace-regexp' to fix those lines.
>
> With a little effort you can write a command file for `sed' to do what the
> code block above does and then pipe the pandoc output to that command like
> this:
>
> : pandoc -f markdown -t org input-file.Rmd | \
> : sed -f convert-chunks > output-file.org
>
> and you have an org document ready (or almost ready) to go.
>
>
> HTH,
>
> Chuck
>
>

[-- Attachment #2: Type: text/html, Size: 2655 bytes --]

  reply	other threads:[~2016-07-20 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20  4:28 convert rmarkdown (rmd) files to orgmode? Xebar Saram
     [not found] ` <CAJ1MqVF4Cq3ogH34P6AtSf0-ZX7ic=tApuX-ad=+14pLF7p1Aw@mail.gmail.com>
2016-07-20 11:15   ` Xebar Saram
2016-07-20 17:20     ` Charles C. Berry
2016-07-20 17:29       ` Xebar Saram [this message]
2016-07-20 17:42         ` Charles C. Berry
2016-07-20 18:00           ` Xebar Saram
2016-07-21  6:48             ` Xebar Saram
2016-07-21 16:27               ` Charles C. Berry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQHXPok-uQWZwo_iU5fPchsrrrjo8nXtsv2wQ1-8fepZFV4nw@mail.gmail.com \
    --to=zeltakc@gmail.com \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=phil.hudson@iname.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).