[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] passing the contents of a block as an escaped string
From: |
Alan Schmitt |
Subject: |
Re: [O] passing the contents of a block as an escaped string |
Date: |
Thu, 26 Jun 2014 09:27:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) |
Hello Charles,
On 2014-06-24 18:37, Charles Berry <address@hidden> writes:
> ,----
> | #+NAME: prin-block
> | #+BEGIN_SRC emacs-lisp :var a="abc"
> | (defun foo (blk)
> | (save-excursion
> | (org-babel-goto-named-src-block blk)
> | (nth 1 (org-babel-get-src-block-info 'light))))
> |
> | #+END_SRC
> |
> | #+NAME: weird-text
> | #+BEGIN_SRC python
> | just some plain text;
> |
> | \\ a double slash
> |
> | escape eol \n
> |
> | OK??
> | #+END_SRC
> |
> |
> | #+BEGIN_SRC python :var a=(foo "weird-text") :results output
> | print(a);
> | #+END_SRC
> |
> | #+RESULTS:
> | : just some plain text;
> | :
> | : \\ a double slash
> | :
> | : escape eol \n
> | :
> | : OK??
> |
> | #+header: :var a=(prin1-to-string (foo "weird-text"))
> | #+BEGIN_SRC python :results output
> | print(a);
> | #+END_SRC
> |
> | #+RESULTS:
> | : "just some plain text;
> | :
> | : \\\\ a double slash
> | :
> | : escape eol \\n
> | :
> | : OK??"
> `----
Thanks a lot, it works great. I'm now having utf-8, orgmode, and python
problems that I'll explore in another thread.
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
pgp7kAvf0tHHB.pgp
Description: PGP signature