emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* new exporter drops :parameters ?
@ 2012-07-03  3:51 Charles Berry
  2012-07-03  9:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Berry @ 2012-07-03  3:51 UTC (permalink / raw)
  To: emacs-orgmode



I am trying to put together a derived backend that makes use of Src Block
:parameters attribute.

I can see that the header in a begin_src block is picked up by  

org-element-src-block-parser, as it should be when I try it interactively 

But not when I try

M-: (org-export-to-buffer 'my-latex   "*latex out*") RET

Here is an example:

=========================

#+BEGIN_SRC emacs-lisp
  (org-export-define-derived-backend my-latex e-latex
  :translate-alist ((src-block . org-rnw-src-block)))
  
  
  (defun org-rnw-src-block (src-block contents info)
    (org-element-src-block-interpreter src-block contents))
#+END_SRC

(progn
  (forward-line 3)
  (org-element-src-block-interpreter (org-element-src-block-parser) nil)) 
move cursor back after last paren and type C-x C-e
#+name: bblock
#+BEGIN_SRC R :exports code :et-cetera
rnorm(2)+1
#+END_SRC


===========================

Typing C-x C-e as above yields

"#+BEGIN_SRC R :exports code :et-cetera
  rnorm(2)+1
#+END_SRC"

but using the org-export-to-buffer line above yields

[much deleted]
#+BEGIN_SRC R
  rnorm(2)+1
#+END_SRC
% Generated by Org mode 7.8.10 in Emacs 23.3.50.1.
\end{document}

I'd really like to have access to the header elements.

AFAICS :parameters is nowhere to be found when using org-export-to-buffer.

What can I do??

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

* Re: new exporter drops :parameters ?
  2012-07-03  3:51 new exporter drops :parameters ? Charles Berry
@ 2012-07-03  9:16 ` Nicolas Goaziou
  2012-07-04 18:19   ` cberry
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2012-07-03  9:16 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

Hello,

Charles Berry <ccberry@ucsd.edu> writes:

> I am trying to put together a derived backend that makes use of Src Block
> :parameters attribute.
>
> I can see that the header in a begin_src block is picked up by  
>
> org-element-src-block-parser, as it should be when I try it interactively 
>
> But not when I try
>
> M-: (org-export-to-buffer 'my-latex   "*latex out*") RET
>
> I'd really like to have access to the header elements.
>
> AFAICS :parameters is nowhere to be found when using
> org-export-to-buffer.

This is because src blocks are executed before buffer is parsed. You can
try to call `org-export-blocks-preprocess' on the following buffer
(associated to a file):

--8<---------------cut here---------------start------------->8---
  #+name: bblock
  #+BEGIN_SRC R :exports code :et-cetera
  rnorm(2)+1
  #+END_SRC
--8<---------------cut here---------------end--------------->8---

and see what is really parsed: the removal happens on the Babel side.

Depending on your needs, you may want to use ATTR_LATEX keyword instead.


Regards,

-- 
Nicolas Goaziou

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

* Re: new exporter drops :parameters ?
  2012-07-03  9:16 ` Nicolas Goaziou
@ 2012-07-04 18:19   ` cberry
  2012-07-05 20:53     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: cberry @ 2012-07-04 18:19 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Charles Berry <ccberry@ucsd.edu> writes:
>
>> I am trying to put together a derived backend that makes use of Src Block
>> :parameters attribute.
>>
[deleted]
>>
>> AFAICS :parameters is nowhere to be found when using
>> org-export-to-buffer.
>
> This is because src blocks are executed before buffer is parsed. You can
> try to call `org-export-blocks-preprocess' on the following buffer
> (associated to a file):

Thanks! I get it.

It turns out I can piggyback extra info needed on the ':name' element
and use that in lieu of  ':parameters'.

BTW, "#+name: aname" and "#+NAME: aname" are handled differently in e-latex. The
former gets placed in the latex output as "\#+name: aname". Bug?

Chuck

>
>
> --8<---------------cut here---------------start------------->8---
>   #+name: bblock
>   #+BEGIN_SRC R :exports code :et-cetera
>   rnorm(2)+1
>   #+END_SRC
> --8<---------------cut here---------------end--------------->8---
>
> and see what is really parsed: the removal happens on the Babel side.
>
[snip]

-- 
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at ucsd edu			    UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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

* Re: new exporter drops :parameters ?
  2012-07-04 18:19   ` cberry
@ 2012-07-05 20:53     ` Nicolas Goaziou
  2012-07-07  3:22       ` cberry
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2012-07-05 20:53 UTC (permalink / raw)
  To: cberry; +Cc: emacs-orgmode

Hello,

cberry@tajo.ucsd.edu writes:

> BTW, "#+name: aname" and "#+NAME: aname" are handled differently in e-latex. The
> former gets placed in the latex output as "\#+name: aname". Bug?

There is a known bug about affiliated keywords not being removed during
export, but I don't know if you're describing the same problem.

Do you have an ECM illustrating it ?


Regards,

-- 
Nicolas Goaziou

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

* Re: new exporter drops :parameters ?
  2012-07-05 20:53     ` Nicolas Goaziou
@ 2012-07-07  3:22       ` cberry
  0 siblings, 0 replies; 5+ messages in thread
From: cberry @ 2012-07-07  3:22 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> cberry@tajo.ucsd.edu writes:
>
>> BTW, "#+name: aname" and "#+NAME: aname" are handled differently in e-latex. The
>> former gets placed in the latex output as "\#+name: aname". Bug?
>
> There is a known bug about affiliated keywords not being removed during
> export, but I don't know if you're describing the same problem.
>
> Do you have an ECM illustrating it ?

Yes and No.

I tried to put an ECM together earlier today, but couldn't trigger the
bug.

Then a few minutes ago it bit.

And this simple subtree triggered it:

,----
| * here is a subtree to export
| #+COMMENT: (org-export-to-buffer 'e-latex   "*rnw out*" t)
| 
| ** src block
| 
| #+name: ablock          
| #+begin_src R
| rnorm(10)
| #+end_src
`----

But I restarted emacs, loaded contrib/lisp/org-export.el and
contrib/lisp/org-e-latex.el, and ran the command in the COMMENT line
again and the *rnw out* buffer looked justed fine (no \#+name... stuff).

And I repeated as many of my earlier steps as I could and still no bug bite.

So whatever the problem is, it is not something I can reliably reproduce.

If I come up with anything, I'll get back to you. 

Chuck

>
>
> Regards,

-- 
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at ucsd edu			    UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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

end of thread, other threads:[~2012-07-07  3:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03  3:51 new exporter drops :parameters ? Charles Berry
2012-07-03  9:16 ` Nicolas Goaziou
2012-07-04 18:19   ` cberry
2012-07-05 20:53     ` Nicolas Goaziou
2012-07-07  3:22       ` cberry

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