[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: |
Charles Berry |
Subject: |
Re: [O] Possible to use src block to generate org headlines for export? |
Date: |
Thu, 24 Jul 2014 18:40:24 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Nick Dokos <ndokos <at> gmail.com> writes:
>
> Charles Berry <ccberry <at> ucsd.edu> writes:
>
> > Matt Lundin <mdl <at> imapmail.org> writes:
> >
> > [deleted]
[more deleted]
> > 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.
>
Fair enough. But getting assurance that an export process is really up and
running looked tricky to me - what with anonymous backends and `info' being
let-bound by babel. So this is what I came up with for a more robust test.
Hopefully, nobody will bind both `backend' and `org-export-current-backend'
to a common backend outside of doing an export...
#+BEGIN_SRC emacs-lisp
(defun org-export-if-exporting (export-val &optional other-val)
"If backend exists, is a backend, and is currently running
return EXPORT-VAL otherwise return OTHER-VAL or \"\"."
(if
(and (boundp 'backend)
(equal (car (append backend nil))
'cl-struct-org-export-backend)
(equal org-export-current-backend
(org-export-backend-name backend)))
export-val
(or other-val "")))
#+END_SRC
#+header: :results (org-export-if-exporting "raw")
#+BEGIN_SRC emacs-lisp :exports both
(format "* headline\n1\n2\n6\n")
#+END_SRC
Chuck
- Re: [O] Possible to use src block to generate org headlines for export?, (continued)
- Re: [O] Possible to use src block to generate org headlines for export?, Andreas Leha, 2014/07/24
- Re: [O] Possible to use src block to generate org headlines for export?, Nicolas Goaziou, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Andreas Leha, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Nicolas Goaziou, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Andreas Leha, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Thorsten Jolitz, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Nicolas Goaziou, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Andreas Leha, 2014/07/25
- Re: [O] Possible to use src block to generate org headlines for export?, Nicolas Goaziou, 2014/07/26
- Re: [O] Possible to use src block to generate org headlines for export?, Andreas Leha, 2014/07/26
- Re: [O] Possible to use src block to generate org headlines for export?,
Charles Berry <=
- Re: [O] Possible to use src block to generate org headlines for export?, Nick Dokos, 2014/07/24
- Re: [O] Possible to use src block to generate org headlines for export?, Brett Viren, 2014/07/23
- Re: [O] Possible to use src block to generate org headlines for export?, Matt Lundin, 2014/07/23
- Re: [O] Possible to use src block to generate org headlines for export?, Brett Viren, 2014/07/24
- Re: [O] Possible to use src block to generate org headlines for export?, Rick Frankel, 2014/07/23