emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Lawrence Mitchell <wence@gmx.li>
Cc: Bastien <bastienguerry@googlemail.com>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-html: Fix logic for export of section numbers
Date: Tue, 29 Mar 2011 09:07:44 -0400	[thread overview]
Message-ID: <874o6mqdlr.fsf@norang.ca> (raw)
In-Reply-To: <m3fwq6z5uk.fsf@e4300lm.epcc.ed.ac.uk> (Lawrence Mitchell's message of "Tue, 29 Mar 2011 09:30:27 +0100")

Hi Lawrence.

Thanks for the quick fix.

This patch fixes the problem for me.

Best regards,
Bernt

Lawrence Mitchell <wence@gmx.li> 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 "<span class=\"section-number-%d\">%s</span>"
>  				 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</div>\n"))
>  	(setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist)))

      reply	other threads:[~2011-03-29 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29  4:05 Bug: Numbering in TOC broken for HTML export [7.5 (release_7.5.132.gf04d4)] Bernt Hansen
2011-03-29  8:30 ` [PATCH] org-html: Fix logic for export of section numbers Lawrence Mitchell
2011-03-29 13:07   ` Bernt Hansen [this message]

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=874o6mqdlr.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=bastienguerry@googlemail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wence@gmx.li \
    /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).