From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Limit subtree to a specific export backend Date: Fri, 04 Oct 2013 14:36:20 +0200 Message-ID: <87wqltp60r.fsf@gmx.us> References: <87li2e70vv.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VS4cV-0007vK-OC for emacs-orgmode@gnu.org; Fri, 04 Oct 2013 08:36:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VS4cN-0007Dd-IT for emacs-orgmode@gnu.org; Fri, 04 Oct 2013 08:36:35 -0400 Received: from mout.gmx.net ([212.227.15.15]:53686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VS4cN-0007D1-A7 for emacs-orgmode@gnu.org; Fri, 04 Oct 2013 08:36:27 -0400 Received: from pank ([192.167.90.133]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LjaEi-1VywWe1riK-00bd8K for ; Fri, 04 Oct 2013 14:36:24 +0200 In-Reply-To: (Sebastian Wiesner's message of "Fri, 4 Oct 2013 12:33:16 +0200") 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: lunaryorn@gmail.com Cc: emacs-orgmode@gnu.org Sebastian Wiesner writes: > I presume, I can set "org-export-filter-options-functions" as a > directory-local variable, so that this kind of export restrictions > only applies to Org mode documents in the specific project. Probably. There was some discussions on it lately. Check the archive. >> 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 :l= atex: >> the math is really pretty! >> ** HTML heading := html: >> the text features hyperlinks! >> ** More common notes >> Intro over >> >> * Code :noex= port: >> #+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 differentl= y: >> ;; (backend-or-parent backend) >> (backend-or-parent (dolist (b org-export--registered-backends = return) >> (when (eq (org-export-backend-name b) ba= ckend) >> (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 > > Do I understand correctly, that this code adds all *other* backends to > the "exclude-tags" setting, instead of adding the current one to > "select-tags"? Is there a specific reason to do this? Let me know if it doesn't work as desired and share your improvements. I didn't do proper testing as I don't fully appreciate all corner cases of the use case. On select tag, you can use it if you like how this document works=20 #+SELECT_TAGS: latex * common intro test=20 ** html intro :htm= l: html ** latex :late= x: latex * common next section=20 Next section > Just adding "backend" to "select-tags" seems simpler to me, and I > wonder whether "exclude-tags" even behaves correctly for headlines > with more than one tag. As far as I understand the Org manual, it > would exclude headlines tagged as ":html:latex:" when exporting to > "html", because "latex" is added as exclude-tag, preventing the > headline from being exported. You should be able to test this in a normal org document. =E2=80=93Rasmus --=20 C is for Cookie