emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Export: Override headline numbering via properties
@ 2013-05-13  3:07 Mark Edgington
  2013-05-13  6:18 ` Nicolas Goaziou
       [not found] ` <CAJcAo8u+pAqwuPtRDpDaLc7QE_1BvR7MXchgZRQDLRAv_iQ2Wg@mail.gmail.com>
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Edgington @ 2013-05-13  3:07 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-23 19:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13  3:07 [PATCH] Export: Override headline numbering via properties Mark Edgington
2013-05-13  6:18 ` 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

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