From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: proposal to have ignoreheading tags/properties Date: Thu, 12 Jun 2014 16:13:27 -0400 Message-ID: <871tutx4t4.fsf@gmail.com> References: <87tx7qxahl.fsf@gmail.com> <87ppie2c2h.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvBQ0-0005U2-Br for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvBPv-00006y-J0 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:16:16 -0400 Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:60888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvBPv-00006o-D1 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:16:11 -0400 Received: by mail-ob0-f178.google.com with SMTP id wn1so1883739obc.37 for ; Thu, 12 Jun 2014 13:16:11 -0700 (PDT) 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: Nicolas Girard Cc: emacs-orgmode , Mark Edgington --=-=-= Content-Type: text/plain > > I also ran across this need. What I had in mind was that certain todo > types would be treated as inline. > For instance, if "P" was a member of this hypothetical > org-inline-todo-keywords, then > > * P a paragraph > some contents > > would be rendered as > > some contents > > by the exporter, no matter the backend. > > Such a feature is more generic and would be useful in other contexts ; > and the LaTeX-related issues discussed in this thread would be solved > using something like > > * INLINE appendix > \appendix > * Appendix 1 > Why TODO types rather than a tag? IMO using a TODO type would conflate task management and document structuring. What do you think about the attached patch which should add this functionality to the core. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-export-removes-INLINE-heading-and-promotes-subtree.patch >From 5a41eae2af24097ec9c1507926af6f6fab8f2628 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 12 Jun 2014 16:11:04 -0400 Subject: [PATCH] export removes INLINE heading and promotes subtree * lisp/ox.el (org-export-remove-and-promote-children-of-inline-headlines): A new function. (org-export-as): Include `org-export-remove-and-promote-children-of-inline-headlines' in the export process. --- lisp/ox.el | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lisp/ox.el b/lisp/ox.el index 4bfef52..961d795 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -2320,6 +2320,29 @@ tree is modified by side effect and returned by the function." (plist-get info prop) info)))) +(defun org-export-remove-and-promote-children-of-inline-headlines (data info) + "Remove inline headlines and promote their children. +DATA is the parse tree. INFO is a plist containing export +options. Each headline tagged as INLINE will be removed +retaining its contents, and promoting any children headlines by a +single level." + (org-element-map data org-element-all-elements + (lambda (object) + (when (and (equal 'headline (org-element-type object)) + (or (member "inline" (org-element-property :tags object)) + (member "INLINE" (org-element-property :tags object)))) + (mapc (lambda (el) + ;; recursively promote all nested headlines + (org-element-map el 'headline + (lambda (el) + (when (equal 'headline (org-element-type el)) + (org-element-put-property el + :level (1- (org-element-property :level el)))))) + (org-element-insert-before el object)) + (cddr object)) + (org-element-extract-element object))) + info nil org-element-all-elements)) + (defun org-export--remove-uninterpreted-data-1 (data info) "Change uninterpreted elements back into Org syntax. DATA is a parse tree or a secondary string. INFO is a plist @@ -3124,6 +3147,9 @@ Return code as a string." ;; Handle left-over uninterpreted elements or objects in ;; parse tree and communication channel. (org-export-remove-uninterpreted-data tree info) + ;; Remove headlines tagged as inline and promote their + ;; children. + (org-export-remove-and-promote-children-of-inline-headlines tree info) ;; Call options filters and update export options. We do not ;; use `org-export-filter-apply-functions' here since the ;; arity of such filters is different. -- 2.0.0 --=-=-= Content-Type: text/plain > > > Cheers, > > Nicolas -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw) --=-=-=--