emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Nicolas Girard <girard.nicolas@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>,
	Mark Edgington <edgimar@gmail.com>
Subject: Re: proposal to have ignoreheading tags/properties
Date: Thu, 12 Jun 2014 16:13:27 -0400	[thread overview]
Message-ID: <871tutx4t4.fsf@gmail.com> (raw)
In-Reply-To: CANMKmefZhHipUtcPm7qtg25_YwZJXXav5MFUnKt4ATy0v+uazg@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

>
> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-export-removes-INLINE-heading-and-promotes-subtree.patch --]
[-- Type: text/x-diff, Size: 2596 bytes --]

From 5a41eae2af24097ec9c1507926af6f6fab8f2628 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 117 bytes --]


>
>
> Cheers,
>
> Nicolas

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

  parent reply	other threads:[~2014-06-12 20:16 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 16:49 proposal to have ignoreheading tags/properties Mark Edgington
2014-06-12 17:32 ` Thorsten Jolitz
2014-06-12 17:41   ` Ken Mankoff
2014-06-12 18:11     ` Thorsten Jolitz
2014-06-12 18:16       ` Ken Mankoff
2014-06-13 14:32       ` Rasmus
2014-06-13 15:02         ` Thorsten Jolitz
2014-06-12 18:09   ` Mark Edgington
2014-06-12 18:12 ` Eric Schulte
2014-06-12 18:54   ` Aaron Ecay
2014-06-12 19:21     ` Nicolas Girard
2014-06-12 19:26       ` Ken Mankoff
2014-06-12 19:52         ` Nicolas Girard
2014-06-13  1:20         ` Samuel Wales
2014-06-12 19:34       ` Nicolas Girard
2014-06-12 20:13       ` Eric Schulte [this message]
2014-06-12 22:42         ` Nicolas Girard
2014-06-12 23:36           ` Eric Schulte
2014-06-13  0:35         ` Ken Mankoff
2014-06-13  0:46           ` Eric Schulte
2014-06-13  2:35             ` Ken Mankoff
2014-06-13 11:11               ` Eric Schulte
2014-06-13  3:28             ` Mark Edgington
2014-06-13 14:23         ` Rasmus
2014-06-14 12:43         ` Nicolas Goaziou
2014-06-14 16:48           ` Mark Edgington
2014-06-14 18:12             ` Aaron Ecay
2014-06-14 18:12             ` Nicolas Goaziou
2014-06-14 18:07           ` Aaron Ecay
2014-06-14 18:22             ` Nicolas Goaziou
2014-06-14 22:39               ` Aaron Ecay
2014-06-16  1:14           ` Eric Schulte
2014-06-16  8:08             ` Nicolas Goaziou
2014-06-16 12:19               ` Mark Edgington
2014-06-16 13:29               ` Eric Schulte
2014-06-22  2:03                 ` Aaron Ecay
2014-06-22 23:52                   ` Eric Schulte
2014-07-27 17:21                     ` Bastien
2014-07-28 18:15                       ` Mark Edgington
2014-07-28 18:27                       ` Rasmus
2014-07-28 19:21                         ` Mark Edgington
2014-07-28 19:43                       ` Nicolas Goaziou
2014-07-28 22:01                         ` Rasmus
2014-07-29 14:31                         ` Bastien
2014-08-02  5:16                           ` Mark Edgington
2014-08-06  4:09                             ` Aaron Ecay
2014-06-13  2:38 ` Eric Abrahamsen
2014-06-13  4:07   ` Mark Edgington
2014-06-13  4:44     ` Eric Abrahamsen

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=871tutx4t4.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=edgimar@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=girard.nicolas@gmail.com \
    /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).