From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Edgington Subject: [PATCH] Export: Override headline numbering via properties Date: Sun, 12 May 2013 23:07:35 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ubj7G-0000IV-Iw for emacs-orgmode@gnu.org; Sun, 12 May 2013 23:07:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ubj7F-0007uH-M6 for emacs-orgmode@gnu.org; Sun, 12 May 2013 23:07:58 -0400 Received: from mail-ob0-x22e.google.com ([2607:f8b0:4003:c01::22e]:50354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ubj7F-0007tG-H3 for emacs-orgmode@gnu.org; Sun, 12 May 2013 23:07:57 -0400 Received: by mail-ob0-f174.google.com with SMTP id un3so1006868obb.19 for ; Sun, 12 May 2013 20:07:56 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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