From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: exporting "flattened" tagged subtrees Date: Fri, 01 Dec 2017 15:26:35 +0100 Message-ID: <87po7yo76s.fsf@gmx.us> References: <87a7z410vn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKnSo-00053a-4L for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:44:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKnS3-0001Hb-UC for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:42:53 -0500 Received: from [195.159.176.226] (port=50570 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKnS3-0001Dv-FX for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:42:07 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eKmH0-0006TU-O8 for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 15:26:38 +0100 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" To: emacs-orgmode@gnu.org Michel Damiens writes: > Hello, > > I would like to export and org file in such a way that : > - only tagged subtrees are exported (for a specific tag) > - the tree structure is "flattened" > > for example a file example.org containing : > * heading 1 :tag: > ** subheading 1.1 > content 1.1 > ** subheading 1.2 :tag: > content 1.2 > *heading 2 > ** subheading 2.1 :tag: > content 2.1 > ** subheading 2.1.1 :tag: > ** subheading 2.1.2 :tag: > content 2.1.2 > ** subheading 2.2 > content 2.2 > > would be exported to the file example.org.org containing : > * heading 1 > * subheading 1.2 > content 1.2 > * subheading 2.1 > content 2.1 > * subheading 2.1.1 > * subheading 2.1.2 > content 2.1.2 > > (which in turn would be exported to latex, beamer or html for example) The first part you can archive with these tags: #+SELECT_TAGS:, #+EXCLUDE_TAGS: These lines provide settings for exporting files. For more details see Export settings . Flatting the file can be done by search and replace (while (search-forward-regexp "^*+ " nil t) (replace-match "* ")) Rasmus -- ツ