emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mark Edgington <edgimar@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Export: Override headline numbering via properties
Date: Sun, 12 May 2013 23:07:35 -0400	[thread overview]
Message-ID: <CAMsBe8qCd55NO8f92Z=hO_Z5_1N1Mgd6t3GVXEt3cscX0tzdtA@mail.gmail.com> (raw)

* lisp/ox.el (org-export-numbered-headline-p): If the `:NUMBERED' property is
defined for a headline, turn numbering on when the property value is "y"
(otherwise turn numbering off).  Do the same if the `:INHERITED_NUMBERED'
property is defined for a headline, except make this property inherited by
child nodes.  If both properties are nil or not defined, resort to the
default numbering
behavior.

TINYCHANGE
---
 lisp/ox.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 06513d2..137db9e 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3721,8 +3721,14 @@ INFO is a plist holding contextual information."
   "Return a non-nil value if HEADLINE element should be numbered.
 INFO is a plist used as a communication channel."
   (let ((sec-num (plist-get info :section-numbers))
-       (level (org-export-get-relative-level headline info)))
-    (if (wholenump sec-num) (<= level sec-num) sec-num)))
+       (level (org-export-get-relative-level headline info))
+    (numbered (org-export-get-node-property :NUMBERED headline))
+    (inherited-numbered (org-export-get-node-property
:INHERITED_NUMBERED headline t))) ; y, n, or nil
+    (if numbered ; if the numbered property is defined
+        (equal numbered "y") ; anything other than "y" means un-numbered
+        (if inherited-numbered
+            (equal inherited-numbered "y")
+            (if (wholenump sec-num) (<= level sec-num) sec-num))))) ;
default behavior

 (defun org-export-number-to-roman (n)
   "Convert integer N into a roman numeral."
--
1.8.2.2

             reply	other threads:[~2013-05-13  3:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  3:07 Mark Edgington [this message]
2013-05-13  6:18 ` [PATCH] Export: Override headline numbering via properties Nicolas Goaziou
2013-05-13  9:42   ` Mark Edgington
2013-05-13 10:54     ` Nicolas Goaziou
2013-05-14  4:39       ` Mark Edgington
2013-05-17  3:19         ` Albert Z. Wang
2013-05-23 19:03           ` Nicolas Goaziou
2013-05-13 10:11   ` Mark Edgington
     [not found] ` <CAJcAo8u+pAqwuPtRDpDaLc7QE_1BvR7MXchgZRQDLRAv_iQ2Wg@mail.gmail.com>
2013-05-13 10:08   ` Mark Edgington

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='CAMsBe8qCd55NO8f92Z=hO_Z5_1N1Mgd6t3GVXEt3cscX0tzdtA@mail.gmail.com' \
    --to=edgimar@gmail.com \
    --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).