From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roland DONAT Subject: Re: :RESULTS: drawer exported in LaTeX Date: Tue, 15 Jul 2014 19:34:08 +0000 (UTC) Message-ID: References: <87r41m5z0s.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X78Uh-0002g9-I1 for emacs-orgmode@gnu.org; Tue, 15 Jul 2014 15:34:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X78UZ-0000NY-QE for emacs-orgmode@gnu.org; Tue, 15 Jul 2014 15:34:31 -0400 Received: from plane.gmane.org ([80.91.229.3]:53082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X78UZ-0000NM-GA for emacs-orgmode@gnu.org; Tue, 15 Jul 2014 15:34:23 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X78UX-0002SO-Gn for emacs-orgmode@gnu.org; Tue, 15 Jul 2014 21:34:21 +0200 Received: from vsp56-2-88-169-163-185.fbx.proxad.net ([88.169.163.185]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Jul 2014 21:34:21 +0200 Received: from roland.donat by vsp56-2-88-169-163-185.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Jul 2014 21:34:21 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos gmail.com> writes: > > Roland DONAT 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.