emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Code block returning code results formatted as another type of code block?
@ 2016-02-03 22:39 Brett Viren
  2016-02-04  5:03 ` Charles C. Berry
  0 siblings, 1 reply; 3+ messages in thread
From: Brett Viren @ 2016-02-03 22:39 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

I have some shell command line program that spits out JSON.  I want Org
execute that command from a source block (of type "sh") and have the
result displayed as another source block of type "json".  I can almost
get all that working except the resulting block is also of type "sh":

I have:


#+BEGIN_SRC sh  :exports both :format json :results value code 
echo '{"foo":"bar", "baz":"quax"}'
#+END_SRC

#+RESULTS:
#+BEGIN_SRC sh
{"foo":"bar", "baz":"quax"}
#+END_SRC


But, instead, I want the result:


#+RESULTS:
#+BEGIN_SRC json
{"foo":"bar", "baz":"quax"}
#+END_SRC


Is there some arg to the initial source block which I'm missing?

I guessed with that ":format json" arg.  With or without it makes no
difference.


Thanks!
-Brett.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Code block returning code results formatted as another type of code block?
  2016-02-03 22:39 Code block returning code results formatted as another type of code block? Brett Viren
@ 2016-02-04  5:03 ` Charles C. Berry
  2016-02-04 13:49   ` Brett Viren
  0 siblings, 1 reply; 3+ messages in thread
From: Charles C. Berry @ 2016-02-04  5:03 UTC (permalink / raw)
  To: Brett Viren; +Cc: emacs-orgmode

On Wed, 3 Feb 2016, Brett Viren wrote:

> Hi,
>
> I have some shell command line program that spits out JSON.  I want Org
> execute that command from a source block (of type "sh") and have the
> result displayed as another source block of type "json".


Try `:wrap src json':

#+BEGIN_SRC sh  :exports both :results value code :wrap src json
echo '{"foo":"bar", "baz":"quax"}'
#+END_SRC

#+RESULTS:
#+BEGIN_src json
{"foo":"bar", "baz":"quax"}
#+END_src


HTH,

Chuck

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Code block returning code results formatted as another type of code block?
  2016-02-04  5:03 ` Charles C. Berry
@ 2016-02-04 13:49   ` Brett Viren
  0 siblings, 0 replies; 3+ messages in thread
From: Brett Viren @ 2016-02-04 13:49 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode

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

"Charles C. Berry" <ccberry@ucsd.edu> writes:

> Try `:wrap src json':

Works perfectly, thanks.  I had missed this in the manual, but it was
there for me all along!

  http://orgmode.org/manual/wrap.html

-Brett.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-04 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03 22:39 Code block returning code results formatted as another type of code block? Brett Viren
2016-02-04  5:03 ` Charles C. Berry
2016-02-04 13:49   ` Brett Viren

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).