The problem is that the results you generate is a table with affiliated keywords NAME and CAPTION and ATTR_[backend].

`org-at-table-p' does not recognize that the keywords are followed by a table.  Altering this function might be asking for trouble as it is used outside babel.

So maybe the cond test should refer to `org-element-context' to better sort this out and correctly identify the table end.


Thanks for the explanation.

Since this was meant for use in a tutorial, I wanted #+NAME, etc to be there.

I will have to use some other work around. :wrap does not work for me, as it does not remove the , escape characters.

Thanks again,

Vikas