emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: emacs-orgmode@gnu.org
Subject: ox-texinfo: add support for NONODE element property
Date: Fri, 08 Apr 2016 12:29:32 +0200	[thread overview]
Message-ID: <87egagfl6b.fsf@bernoul.li> (raw)

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	other threads:[~2016-04-08 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 10:29 Jonas Bernoulli [this message]
2016-04-08 10:40 ` ox-texinfo: add support for NONODE element property Jonas Bernoulli
2016-04-10  7:18 ` Nicolas Goaziou

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=87egagfl6b.fsf@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=emacs-orgmode@gnu.org \
    /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).