[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] :RESULTS: drawer exported in LaTeX
From: |
Roland DONAT |
Subject: |
Re: [O] :RESULTS: drawer exported in LaTeX |
Date: |
Tue, 15 Jul 2014 19:34:08 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Nick Dokos <ndokos <at> gmail.com> writes:
>
> Roland DONAT <roland.donat <at> gmail.com> writes:
>
> > Dear Orgmode community,
> >
> > I have this piece of python code that generate Orgmode text :
> >
> > #+NAME: test
> > #+HEADER: :session test1
> > #+HEADER: :results value drawer
> > #+BEGIN_SRC python
> > a = "** H1\nblabla\n** H2\nbloblo"
> > a
> > #+END_SRC
> >
> > #+RESULTS: test
> > :RESULTS:
> > ** H1
> > blabla
> > ** H2
> > bloblo
> > :END:
> >
> > But when I export my document in LaTeX, the :RESULTS: drawer appears in
the
> > final pdf which it's not cool...
> >
> > I have a d:nil in my OPTIONS header.
> >
>
> There is either a bug in the parser or a drawer cannot contain headlines
> (probably the latter): running org-element-parse-buffer on the following:
>
> --8<---------------cut here---------------start------------->8---
> #+STARTUP: noindent
> #+OPTIONS: toc:nil
>
> * foo
> :RESULTS:
>
> ** foo1
> blabla
> bloblo
> :END:
>
> * Local variables
>
:noexport:
>
> # Local Variables:
> # org-export-with-drawers: ("RESULTS")
> # End:
> --8<---------------cut here---------------end--------------->8---
>
> gives me:
>
> --8<---------------cut here---------------start------------->8---
> (org-data nil
> (section
> (:begin 1 :end 41 :contents-begin 1 :contents-end 40 :post-blank
1 :parent #0)
> (keyword
> (:key \"STARTUP\" :value \"noindent\" :begin 1 :end 21 :post-
blank 0 :post-affiliated 1 :parent #1))
> (keyword
> (:key \"OPTIONS\" :value \"toc:nil\" :begin 21 :end 40 :post-
blank 0 :post-affiliated 21 :parent #1)))
> (headline
> (:raw-value \"foo\" :begin 41 :end 87 :pre-blank 0 :contents-
begin 47 :contents-end 86 :level 1
> :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1
:footnote-section-p nil
> :archivedp nil :commentedp nil :title
> (#(\"foo\" 0 3
> (:parent #1)))
> :parent #0)
> (section
> (:begin 47 :end 58 :contents-begin 47 :contents-end 57 :post-
blank 1 :parent #1)
> (paragraph
> (:begin 47 :end 57 :contents-begin 47 :contents-end 57 :post-
blank 0 :post-affiliated 47 :parent #2)
> >>>> #(\":RESULTS:\\n\" 0 10
> (:parent #3))))
> (headline
> (:raw-value \"foo1\" :begin 58 :end 86 :pre-blank 0 :contents-
begin 66 :contents-end 86 :level 2
> :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0
:footnote-section-p nil
> :archivedp nil :commentedp nil :title
> (#(\"foo1\" 0 4
> (:parent #2)))
> :parent #1)
> (section
> (:begin 66 :end 87 :contents-begin 66 :contents-end 86 :post-
blank 1 :parent #2)
> (paragraph
> (:begin 66 :end 80 :contents-begin 66 :contents-end 80 :post-
blank 0 :post-affiliated 66 :parent #3)
> #(\"blabla\\nbloblo\\n\" 0 14
> (:parent #4)))
> >>>> (drawer
> (:begin 80 :end 86 :drawer-name \"END\" :contents-begin nil
:contents-end nil :post-blank 0
> :post-affiliated 80 :parent #3)))))
> (headline
> (:raw-value \"Local variables\" :begin 87 :end 198 :pre-blank 1
:contents-begin 133 :contents-end 198
> :level 1 :priority nil :tags
> (\"noexport\")
> :todo-keyword nil :todo-type nil :post-blank 0
:footnote-section-p nil :archivedp nil :commentedp
> nil :title
> (#(\"Local variables\" 0 15
> (:parent #1)))
> :parent #0)
> (section
> (:begin 133 :end 198 :contents-begin 133 :contents-end 198
:post-blank 0 :parent #1)
> (comment
> (:begin 133 :end 198 :value \"Local
> Variables:\\norg-export-with-drawers:
> (\\\"RESULTS\\\")\\nEnd:\" :post-blank 0 :post-affiliated 133
> :parent #2)))))
>
> --8<---------------cut here---------------end--------------->8---
>
> so :RESULTS: is somehow misinterpreted as a paragraph and :END: as an
> empty drawer, instead of as the end of the RESULTS drawer.
>
> If there is no headline inside the drawer, then there is no
> misinterpretation, IOW the following works:
>
> --8<---------------cut here---------------start------------->8---
> #+STARTUP: noindent
> #+OPTIONS: toc:nil
>
> * foo
> :RESULTS:
>
> blabla
> bloblo
> :END:
>
> * Local variables
>
:noexport:
>
> # Local Variables:
> # org-export-with-drawers: ("RESULTS")
> # End:
> --8<---------------cut here---------------end--------------->8---
>
> The final verdict has to be issued by Nicolas however. If it's not a
> bug, then you will have to modify your method (I would have said that
> "raw" is the best solution, but since you have already rejected that,
> I'm not sure what else to suggest).
>
> --
> Nick
>
>
Thank you very much for your analysis!
You're right, there is something wrong between the parser and the
headlines... I hope it's a bug because I can't think of a reason to prevent
user from inserting headlines between drawers, and I pointed, I haven't
other non-dirty solution ;)
In addition, the parser seems to misinterpret the headlines which are part
of a python string as follows :
--8<---------------cut here---------------start------------->8---
#+NAME: test
#+HEADER: :session test1
#+HEADER: :results value drawer
#+BEGIN_SRC python
a = """** H1
blabla
** H2
bloblo
"""
a
#+END_SRC
#+RESULTS: test
:RESULTS:
** H1
blabla
** H2
bloblo
:END:
--8<---------------cut here---------------end--------------->8---
Produces the following tex file :
--8<---------------cut here---------------start------------->8---
\#+BEGIN\_SRC python
a = """** H1
blabla
\subsection{H2}
\label{sec-1-1}
bloblo
"""
a
\#+END\_SRC
:RESULTS:
\subsection{H1}
\label{sec-1-2}
blabla
\subsection{H2}
\label{sec-1-3}
bloblo
:END:
--8<---------------cut here---------------end--------------->8---
As you can see, it's a little bit messy in there but unfortunately I haven't
the skills to understand what is happening and nor to know where to look at
in the orgmode code...
Thanks anyway, we are progressing on this issue!
Cheers,
Roland.