From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Limit subtree to a specific export backend
Date: Mon, 30 Sep 2013 18:03:16 +0200 [thread overview]
Message-ID: <87li2e70vv.fsf@gmx.us> (raw)
In-Reply-To: CALf2awQcOB4CV8bk_Q_P=BjOsh3SC+OPx8WGvy4Oe4xQJ0CR3A@mail.gmail.com
Hi Sebastian,
Sebastian Wiesner <lunaryorn@gmail.com> writes:
> can I limit a subtree to be exported with specific backends only?
> I.e. only to HTML, but not Texinfo or LaTeX?
>
> Background: I am trying to simplify the documentation of one of my
> projects, and combine the website and the user manual into a single
> document. Naturally, there is some content on the website that should
> not appear in the manual and vice versa.
As Sebastien suggests, if you can identify export status depending on
tags you can do it with a filter.
Here's an example that's perhaps a bit too verbose and not thoroughly
tested:
#+BEGIN_SRC Org
#+TITLE: Conditional export
#+options: tags:nil
* Common intro
txt
** Pdf heading :latex:
the math is really pretty!
** HTML heading :html:
the text features hyperlinks!
** More common notes
Intro over
* Code :noexport:
#+begin_src emacs-lisp
(defun rasmus/conditional-export (settings backend)
"Change SETTINGS to include dynamically set export-tags.
Enable the use of BACKEND as EXPORT_TAGS. A derived backend is
treated as its parent."
(let ((backends (remove-duplicates
(mapcar (lambda (x)
(or (org-export-backend-parent x)
(org-export-backend-name x)))
org-export--registered-backends)))
;; for treating derived backend and parent backends differently:
;; (backend-or-parent backend)
(backend-or-parent (dolist (b org-export--registered-backends return)
(when (eq (org-export-backend-name b) backend)
(return (or (org-export-backend-parent b)
(org-export-backend-name b)))))))
(plist-put
settings :exclude-tags
(append (plist-get settings :exclude-tags)
(mapcar 'symbol-name
(remove backend-or-parent backends))))))
(add-to-list 'org-export-filter-options-functions 'rasmus/conditional-export)
#+end_src
#+END_SRC
--
Enough with the bla bla!
next prev parent reply other threads:[~2013-09-30 16:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 14:06 Limit subtree to a specific export backend Sebastian Wiesner
2013-09-30 14:24 ` Sebastien Vauban
2013-10-03 22:27 ` Sebastian Wiesner
2013-10-04 7:21 ` Sebastien Vauban
2013-09-30 16:03 ` Rasmus [this message]
2013-10-04 10:33 ` Sebastian Wiesner
2013-10-04 12:36 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87li2e70vv.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).