emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: dmg <dmg@uvic.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: evaluation of perl in babel
Date: Mon, 25 Feb 2013 07:11:03 -0700	[thread overview]
Message-ID: <87vc9giimt.fsf@gmail.com> (raw)
In-Reply-To: CAEBXXD84hBRzDTQZhP8kjL+5pyLf=aD_AWnqaDreuh2Yckafyg@mail.gmail.com

dmg <dmg@uvic.ca> writes:

> On Mon, Feb 25, 2013 at 1:54 AM, D M German <dmg@uvic.ca> wrote:
>>
>>  Achim> You may misunderstand some things, or I don't understand what you are
>>  Achim> asking.  It is (at least currently) the responsibility of the Perl
>>  Achim> program (or any other Babel language) to deliver the result in such a
>>  Achim> way that it can be interpreted correctly by the result type chosen (in
>>  Achim> other word, the program output must be valid Org syntax in the given
>>  Achim> context).  You can't have the same program produce tables, vectors and
>>  Achim> LaTeX output just by switching the results type.
>>
>> I understand. But what I want is the output to be wrapped accordingly,
>> and my script to deliver exactly the output as expected. So say I want
>> to generate HTML in my script, I can use :results output, but then I
>> have to change to replace the #+being_example with #+begin_HTML.
>>
>> I guess that I can generate a two dimensional table with perl too
>> using output (printing the necessary | and \n), but then it will be
>> wrapped with #+begin_example.
>
> Ok, I got it. What I need is to return a string with whatever I need.
> A bit cumbersome, but I can live with it
>

It might be worth spending some time with the Org-mode manual.
http://orgmode.org/manual/Working-With-Source-Code.html

You could also use ":results org" or ":results raw", and
then return raw Org-mode from your Perl script instead of html.

Best,

>
>
> #+begin_src perl :results html
> "<table>
> <b>a </b>
> </table>
> "
> #+end_src
>
> #+RESULTS:
> #+BEGIN_HTML
> <table>
> <b>a </b>
> </table>
> #+END_HTML
>
> thanks again for the explanation,

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

      reply	other threads:[~2013-02-25 14:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 21:08 evaluation of perl in babel D M German
2013-02-24 21:25 ` dmg
2013-02-24 22:09 ` Achim Gratz
2013-02-25  9:54   ` D M German
2013-02-25  9:57     ` dmg
2013-02-25 14:11       ` Eric Schulte [this message]

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=87vc9giimt.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=dmg@uvic.ca \
    --cc=emacs-orgmode@gnu.org \
    /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).