* Bug: Numbering in TOC broken for HTML export [7.5 (release_7.5.132.gf04d4)]
@ 2011-03-29 4:05 Bernt Hansen
2011-03-29 8:30 ` [PATCH] org-html: Fix logic for export of section numbers Lawrence Mitchell
0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2011-03-29 4:05 UTC (permalink / raw)
To: emacs-orgmode, Lawrence Mitchell; +Cc: Bastien
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.
--8<---------------cut here---------------start------------->8---
9f57b8e85d185fbf3f9788fd4099709d512dedd1 is the first bad commit
commit 9f57b8e85d185fbf3f9788fd4099709d512dedd1
Author: Lawrence Mitchell <wence@gmx.li>
Date: Wed Mar 23 14:38:18 2011 +0000
Allow mixed export of numbered and unnumbered sections in HTML
* lisp/org-html.el (org-export-as-html): Get local value of
org-export-with-section-numbers from the buffer's plist. Deal
specially with the case the resulting value is an integer.
(org-html-level-start): New optional argument of the option plist used
instead of `org-export-with-section-numbers'. Also deal specially
with the case that the value is an integer.
When `org-export-with-section-numbers' (or the buffer-local
:section-numbers option) is an integer, we now export the first NUM
levels of headings with numbers and lower-level headings without.
:040000 040000 d3f89726820ce5f8c97d6bc21f7c86c46575c203 4e0888ace3fdcafc3385a173d86d9d893d646730 M lisp
--8<---------------cut here---------------end--------------->8---
I noticed this while updating http://doc.norang.ca/org-mode.html and my
TOC turned into a plain unnumbered list.
Reverting this commit fixes the problem for me.
Emacs : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
of 2010-12-11 on raven, modified by Debian
Package: Org-mode version 7.5 (release_7.5.132.gf04d4)
The following org file should have the headings numbered and include a
numbered table of contents.
--8<---------------cut here---------------start------------->8---
#+TITLE: Numbered TOC test for HTML export
#+OPTIONS: H:3 num:t toc:t
* Section One
This is the text for section one.
* Section Two
This is the text for section two.
--8<---------------cut here---------------end--------------->8---
Regards,
--
Bernt
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] org-html: Fix logic for export of section numbers
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 ` Lawrence Mitchell
2011-03-29 13:07 ` Bernt Hansen
0 siblings, 1 reply; 3+ messages in thread
From: Lawrence Mitchell @ 2011-03-29 8:30 UTC (permalink / raw)
To: emacs-orgmode; +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 "<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)))
--
1.7.4.rc2.18.gb20e9
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] org-html: Fix logic for export of section numbers
2011-03-29 8:30 ` [PATCH] org-html: Fix logic for export of section numbers Lawrence Mitchell
@ 2011-03-29 13:07 ` Bernt Hansen
0 siblings, 0 replies; 3+ messages in thread
From: Bernt Hansen @ 2011-03-29 13:07 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: Bastien, emacs-orgmode
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)))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-29 13:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.