emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Possible to use src block to generate org headlines for export?
@ 2014-07-22 23:52 Matt Lundin
  2014-07-23  1:27 ` Nick Dokos
  0 siblings, 1 reply; 25+ messages in thread
From: Matt Lundin @ 2014-07-22 23:52 UTC (permalink / raw)
  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---
<p>
:RESULTS:
</p>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Headline One</h2>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Headline Two</h2>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Headline Three</h2>
<div class="outline-text-2" id="text-3">
</div>
</div>
</div>
--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

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

end of thread, other threads:[~2014-07-26 19:47 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22 23:52 Possible to use src block to generate org headlines for export? Matt Lundin
2014-07-23  1:27 ` Nick Dokos
2014-07-23  2:35   ` Matt Lundin
2014-07-23  2:46     ` Matt Lundin
2014-07-23 13:42     ` Brett Viren
2014-07-23 15:17       ` Matt Lundin
2014-07-23 16:06         ` Charles Berry
2014-07-23 17:07           ` Matt Lundin
2014-07-24  1:51           ` Nick Dokos
2014-07-24 10:21             ` Andreas Leha
2014-07-25  8:31               ` Nicolas Goaziou
2014-07-25 13:05                 ` Andreas Leha
2014-07-25 13:23                   ` Nicolas Goaziou
2014-07-25 13:39                     ` Andreas Leha
2014-07-25 14:26                       ` Thorsten Jolitz
2014-07-25 16:08                       ` Nicolas Goaziou
2014-07-26  0:26                         ` Andreas Leha
2014-07-26  8:07                           ` Nicolas Goaziou
2014-07-26 19:47                             ` Andreas Leha
2014-07-24 18:40             ` Charles Berry
2014-07-24 19:41               ` Nick Dokos
2014-07-23 19:53         ` Brett Viren
2014-07-23 20:42           ` Matt Lundin
2014-07-24 22:05             ` Brett Viren
2014-07-23 16:09     ` Rick Frankel

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