From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: [PATCH] org-html: Fix logic for export of section numbers Date: Tue, 29 Mar 2011 09:07:44 -0400 Message-ID: <874o6mqdlr.fsf@norang.ca> References: <871v1q8tbp.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=51250 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4YeD-0001hD-A1 for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 09:07:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4YeB-0002S3-Vl for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 09:07:49 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:21880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4YeB-0002Rs-Tl for emacs-orgmode@gnu.org; Tue, 29 Mar 2011 09:07:47 -0400 In-Reply-To: (Lawrence Mitchell's message of "Tue, 29 Mar 2011 09:30:27 +0100") 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: Lawrence Mitchell Cc: Bastien , emacs-orgmode@gnu.org Hi Lawrence. Thanks for the quick fix. This patch fixes the problem for me. Best regards, Bernt Lawrence Mitchell writes: > * 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)))