emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Possible to use src block to generate org headlines for export?


From: Andreas Leha
Subject: Re: [O] Possible to use src block to generate org headlines for export?
Date: Thu, 24 Jul 2014 11:21:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin)

Hi all,

Nick Dokos <address@hidden> writes:

> Charles Berry <address@hidden> writes:
>
>> Matt Lundin <mdl <at> imapmail.org> writes:
>>
>> [deleted]
>>
>>> Footnotes:
>>> 
>>> [fn:1] If one really needs to see the headlines in the original org
>>> buffer, a hook can be used to remove the :RESULTS: drawer.
>>> 
>>> --8<---------------cut here---------------start------------->8---
>>> (defun my-remove-stray-results-drawer (backend)
>>>   (when (eq backend 'html)
>>>     (while (re-search-forward "^\\s-*:RESULTS:\\s-*\n" nil t)
>>>       (replace-match ""))))
>>> 
>>> (add-hook 'org-export-before-parsing-hook 'my-remove-results-drawer)
>>> --8<---------------cut here---------------end--------------->8---
>>> 
>>> 
>>
>> Or wrap the results in a drawer when you type C-c C-c, but render them as 
>> raw on export (which removes the drawer and replaces with raw results).
>>
>> Like so:
>>
>> #+header: :results (if (boundp 'backend) "raw" "drawer") 
>> #+BEGIN_SRC emacs-lisp :exports both 
>>
>> (format "* headline\n1\n2\n5\n")
>> #+END_SRC
>>
>
> That's a very nice tip - one small weakness is that it'll do the wrong
> thing if you just happen to have a binding for "backend" outside of the
> export mechanism.


Is that a valid feature request:
Allow the combination of :results raw and :results replace -- regardless
of the produced content?

IIUC the parser does not allow this right now.  But (without any
knowledge on the parser) I can imagine
'special' results drawers that do not have any function/effect other than
delimiting babel results (plus possibly folding).
If these existed, I would even enable them by default no matter of 'raw'
or not.

Something like this:
--8<---------------cut here---------------start------------->8---
#+name: some_code
#+begin_src sh
  echo "hello world"
#+end_src

#+begin_results some_code
: hello world
#+end_results
--8<---------------cut here---------------end--------------->8---

Regards,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]