emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] ox-texinfo: add support for NONODE element property


From: Jonas Bernoulli
Subject: [O] ox-texinfo: add support for NONODE element property
Date: Fri, 08 Apr 2016 12:29:32 +0200
User-agent: mu4e 0.9.17; emacs 25.0.92.1

Hello,

In the Magit manual I usually use separate nodes for sections and
subsections, but in a few cases a section's children should be part
of the section's node.

I accomplished that by adding an additional element property NONODE
and redefining `org-texinfo-headline' and `org-texinfo--menu-entries'
accordingly.  Here is an equivalent patch:

diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index cd3e7ae..23bb1c8 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -777,13 +777,16 @@ (defun org-texinfo-headline (headline contents info)
 holding contextual information."
   (let* ((class (plist-get info :texinfo-class))
         (level (org-export-get-relative-level headline info))
-        (numberedp (org-export-numbered-headline-p headline info))
+        (nonode (org-element-property :NONODE headline))
+        (numberedp (and (not nonode)
+                        (org-export-numbered-headline-p headline info)))
         (class-sectioning (assoc class (plist-get info :texinfo-classes)))
         ;; Find the index type, if any.
         (index (org-element-property :INDEX headline))
         ;; Create node info, to insert it before section formatting.
         ;; Use custom menu title if present.
-        (node (format "@node %s\n" (org-texinfo--get-node headline info)))
+        (node (and (not nonode)
+                   (format "@node %s\n" (org-texinfo--get-node headline 
info))))
         ;; Section formatting will set two placeholders: one for the
         ;; title and the other for the contents.
         (section-fmt
@@ -1147,7 +1150,8 @@ (defun org-texinfo--menu-entries (scope info)
       (puthash scope
               (org-element-map (org-element-contents scope) 'headline
                 (lambda (h)
-                  (and (not (org-not-nil (org-element-property :COPYING h)))
+                  (and (not (org-element-property :NONODE h))
+                       (not (org-not-nil (org-element-property :COPYING h)))
                        (not (org-element-property :footnote-section-p h))
                        (not (org-export-low-level-p h info))
                        h))

The property should probably be renamed to e.g. NOCHILDNODES, since it
is the *children* of the section which has this option set that do not
get any nodes of their own, not the section for which the property is
set.

Please consider adding this or something similar.  Thanks!

  Jonas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]