From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: [PATCH] org-html: Fix logic for export of section numbers Date: Tue, 29 Mar 2011 09:30:27 +0100 Message-ID: References: <871v1q8tbp.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=37713 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4UKM-0001vp-Gd for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 04:31:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4UKK-0007Hw-0V for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 04:31:02 -0400 Received: from nougat.ucs.ed.ac.uk ([129.215.13.205]:56378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4UKJ-0007HC-P8 for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 04:30:59 -0400 In-Reply-To: <871v1q8tbp.fsf@norang.ca> (Bernt Hansen's message of "Tue, 29 Mar 2011 00:05:30 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bastien , Bernt Hansen * lisp/org-html.el (org-export-as-html) (org-html-level-start): Fix logic for section number printing when NUM is an integer. Fixes a bug introduced in 9f57b8e which considered all non-integer values of the num option to be nil. --- Bernt Hansen wrote: > Hi Lawrence, > Numbering of the Table of Contents is broken in master for HTML export. > git bisect identifies the following commit as the cause of this regression. Indeed, I introduced a logic error that considered non-integer values of the num option as nil even when non-nil. I believe this patch fixes the problem, your test case now works as expected again. Cheers, Lawrence lisp/org-html.el | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 62fce1b..48b6740 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1356,7 +1356,9 @@ lang=\"%s\" xml:lang=\"%s\"> (if (string-match quote-re0 txt) (setq txt (replace-match "" t t txt))) (setq snumber (org-section-number level)) - (if (and num (integerp num) (>= num level)) + (if (and num (if (integerp num) + (>= num level) + num)) (setq txt (concat snumber " " txt))) (if (<= level (max umax umax-toc)) (setq head-count (+ head-count 1))) @@ -2404,16 +2406,16 @@ When TITLE is nil, just close all open levels." (setq title (concat (format "%s" level - (if (and (integerp num) - ;; fix up num to take into - ;; account the top-level - ;; heading value - (>= (+ num - org-export-html-toplevel-hlevel - -1) - level)) - snumber - "")) + (if (and num + (if (integerp num) + ;; fix up num to take into + ;; account the top-level + ;; heading value + (>= (+ num org-export-html-toplevel-hlevel -1) + level) + num)) + snumber + "")) " " title))) (unless (= head-count 1) (insert "\n\n")) (setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist))) -- 1.7.4.rc2.18.gb20e9