From: Roland DONAT <roland.donat@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: :RESULTS: drawer exported in LaTeX
Date: Tue, 15 Jul 2014 19:34:08 +0000 (UTC) [thread overview]
Message-ID: <loom.20140715T212356-824@post.gmane.org> (raw)
In-Reply-To: 87r41m5z0s.fsf@alphaville.bos.redhat.com
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.
next prev parent reply other threads:[~2014-07-15 19:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 15:41 :RESULTS: drawer exported in LaTeX Roland DONAT
2014-07-15 17:10 ` Nick Dokos
2014-07-15 19:34 ` Roland DONAT [this message]
2014-07-16 9:39 ` Nicolas Goaziou
2014-07-16 10:48 ` Roland DONAT
2014-07-28 15:25 ` Sebastien Vauban
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20140715T212356-824@post.gmane.org \
--to=roland.donat@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).