emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Put result output in different type of code block than original


From: Eric Schulte
Subject: Re: [O] Put result output in different type of code block than original
Date: Tue, 11 Oct 2011 08:32:58 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Niels Giesen <address@hidden> writes:

> Hi,
>
> Say I've got a sh code block invoking curl to some json api, is it possible
> some way to specify that the format of the output when :results output code
> is in a json code block and *not* a sh code block?
>

Hi Niels,

Currently there is no way to specify the type of returned source code
block.  Hopefully one of Rainer or Rasmus' suggestions to this thread
should serve as a sufficient work around.

I would augment Rainer's solution changing it to the following...

#+begin_src sh :results scalar raw
  echo "#+begin_src json"
    curl 
https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
  echo "#+end_src json"
#+end_src

which works for me -- or presumably would work for me if our-service
could getstfff for dirk with password catsbirthday.

Cheers -- Eric

>
> #+begin_src sh :results output code :exports both
> curl
> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
> #+end_src
>
> #+results:
> #+BEGIN_SRC sh
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> whereas I'd like it to be
>
> #+results:
> #+BEGIN_SRC json
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> Any thoughts on how to go about this? Do other people have this same issue
> and should there come an option in babel that handles this (one language
> outputting source code for another?), or is there a way to specify ones own
> outputter?

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

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