From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Possible to use src block to generate org headlines for export? Date: Tue, 22 Jul 2014 18:52:46 -0500 Message-ID: <87zjg1gddd.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9jrf-000869-S9 for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 19:53:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9jrX-0005k1-OE for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 19:52:59 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46316) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9jrX-0005jg-K3 for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 19:52:51 -0400 Received: from archthink (unknown [50.172.132.15]) by mail.messagingengine.com (Postfix) with ESMTPA id 4D5DE6801CD for ; Tue, 22 Jul 2014 19:52:47 -0400 (EDT) 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: Org Mode I am attempting to use a babel code snippet to generate org headlines for export. However, I seem to be running into a corner case here. AFAICT, the only way to generate headlines safely with babel is to wrap them in a :RESULTS: drawer. Take the following example: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC perl :export results :results output org drawer print "* Headline One\n"; print "* Headline Two\n"; print "* Headline Three\n"; #+END_SRC --8<---------------cut here---------------end--------------->8--- If I hit the source block, it creates wraps the output in a drawer. This protects the results, so when executing the source block again, babel correctly detects the drawer and replaces the output rather than multiplying it indefinitely, as it does with "raw". --8<---------------cut here---------------start------------->8--- #+RESULTS: :RESULTS: * Headline One * Headline Two * Headline Three :END: --8<---------------cut here---------------end--------------->8--- The problem with the results drawer is that org-element (and thus ox.el) does not recognize it as a drawer and thus includes :RESULTS: in the export. The html output looks like this: --8<---------------cut here---------------start------------->8---

:RESULTS:

1 Headline One

2 Headline Two

3 Headline Three

--8<---------------cut here---------------end--------------->8--- In short, is there a more graceful and export-friendly way to use babel to generate org headlines for export? Or is there an easy way to get the export backend to delete the opening part of the drawer (i.e., :RESULTS:)? Any advice would be greatly appreciated. Thanks, Matt