emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] evaluation of perl in babel


From: Eric Schulte
Subject: Re: [O] evaluation of perl in babel
Date: Mon, 25 Feb 2013 07:11:03 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

dmg <address@hidden> writes:

> On Mon, Feb 25, 2013 at 1:54 AM, D M German <address@hidden> 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 via email to

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