emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with src_ruby inline code and []
@ 2016-03-15 18:13 William Denton
  2016-03-15 21:51 ` Charles C. Berry
  0 siblings, 1 reply; 3+ messages in thread
From: William Denton @ 2016-03-15 18:13 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: TEXT/PLAIN, Size: 855 bytes --]

I was updating and exporting a file where I use Ruby to do some basic 
arithmetic on tables, and noticed that inline code blocks where I reference an 
array aren't working.

If you C-c C-c on this simple src_ruby example you get the results.

src_ruby{1 + 2} {{{results(=3=)}}}

But this doesn't work:

#+NAME: sampletable
| name | one | two |
| Me   |   5 |   3 |
| You  |   4 |   6 |

src_ruby[:var t=sampletable]{t[2][2]}

It changes the line to

src_ruby[:var t=sampletable]{t[2] {{{results(==)}}}[2]}

and says:

-:5: syntax error, unexpected keyword_end, expecting ']'
-:7: syntax error, unexpected end-of-input, expecting keyword_end

However, this does work:

#+BEGIN_SRC ruby :var t=sampletable
t[2][2]
#+END_SRC

#+RESULTS:
: 6


Bill
-- 
William Denton ↔  Toronto, Canada ↔  https://www.miskatonic.org/

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

* Re: Problem with src_ruby inline code and []
  2016-03-15 18:13 Problem with src_ruby inline code and [] William Denton
@ 2016-03-15 21:51 ` Charles C. Berry
  2016-03-16 17:18   ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Charles C. Berry @ 2016-03-15 21:51 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

On Tue, 15 Mar 2016, William Denton wrote:

> I was updating and exporting a file where I use Ruby to do some basic 
> arithmetic on tables, and noticed that inline code blocks where I reference 
> an array aren't working.
>

ECM:

src_ruby[:var t=sampletable]{t[2][2]}

#+BEGIN_SRC emacs-lisp
   (save-excursion
     (search-backward (concat "src" "_"))
     (org-element-property :value (org-element-inline-src-block-parser)))
#+END_SRC

#+RESULTS:
: t[2

HTH,

Chuck

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

* Re: Problem with src_ruby inline code and []
  2016-03-15 21:51 ` Charles C. Berry
@ 2016-03-16 17:18   ` Nicolas Goaziou
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2016-03-16 17:18 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: William Denton, emacs-orgmode

Hello,

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

> On Tue, 15 Mar 2016, William Denton wrote:
>
>> I was updating and exporting a file where I use Ruby to do some basic 
>> arithmetic on tables, and noticed that inline code blocks where I reference 
>> an array aren't working.
>>
>
> ECM:
>
> src_ruby[:var t=sampletable]{t[2][2]}
>
> #+BEGIN_SRC emacs-lisp
>    (save-excursion
>      (search-backward (concat "src" "_"))
>      (org-element-property :value (org-element-inline-src-block-parser)))
> #+END_SRC
>
> #+RESULTS: : t[2

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-03-16 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15 18:13 Problem with src_ruby inline code and [] William Denton
2016-03-15 21:51 ` Charles C. Berry
2016-03-16 17:18   ` Nicolas Goaziou

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