* org-e-html and table of contents
@ 2012-08-23 1:55 Eric Schulte
2012-08-23 15:56 ` Nick Dokos
0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2012-08-23 1:55 UTC (permalink / raw)
To: Org Mode Mailing List
Hi,
I've been using the new html exporter (org-e-html) recently, and I'm
surprised that it does not add tables of contents by default. Is there
a user variable which I can customize to change this default? Currently
the only way I see to add a table of contents is to add a TOC keyword to
the buffer.
Thanks,
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 1:55 org-e-html and table of contents Eric Schulte
@ 2012-08-23 15:56 ` Nick Dokos
2012-08-23 16:41 ` Eric Schulte
0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-08-23 15:56 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode Mailing List
Eric Schulte <eric.schulte@gmx.com> wrote:
> Hi,
>
> I've been using the new html exporter (org-e-html) recently, and I'm
> surprised that it does not add tables of contents by default. Is there
> a user variable which I can customize to change this default? Currently
> the only way I see to add a table of contents is to add a TOC keyword to
> the buffer.
>
org-export-with-toc perhaps?
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 15:56 ` Nick Dokos
@ 2012-08-23 16:41 ` Eric Schulte
2012-08-23 17:52 ` Nick Dokos
0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2012-08-23 16:41 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <eric.schulte@gmx.com> wrote:
>
>> Hi,
>>
>> I've been using the new html exporter (org-e-html) recently, and I'm
>> surprised that it does not add tables of contents by default. Is there
>> a user variable which I can customize to change this default? Currently
>> the only way I see to add a table of contents is to add a TOC keyword to
>> the buffer.
>>
>
> org-export-with-toc perhaps?
>
> Nick
>
Nope,
With this variable set to t the e-html backend does *not* produce a
table of contents. To demonstrate, run the following from the command
line with the attached Org-mode file (although any file will do) saved
to /tmp/example.org.
# -*- shell-script -*-
emacs --batch -l path/to/org-mode/lisp/org-element.el \
-l path/to/org-mode/contrib/lisp/org-export.el \
-l path/to/org-mode/contrib/lisp/org-e-html.el \
/tmp/example.org \
--eval '(let ((org-export-with-toc t)) (org-export-to-file (quote e-html) "/tmp/example.html"))'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/x-org, Size: 541 bytes --]
#+Title: example file
* foo
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
accumsan nisl.
* bar
| one | two |
| three | four |
* baz
** sub one
- one
- two
** sub two
- three
- four
[-- Attachment #3: Type: text/plain, Size: 46 bytes --]
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 16:41 ` Eric Schulte
@ 2012-08-23 17:52 ` Nick Dokos
2012-08-23 18:42 ` Eric Schulte
0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-08-23 17:52 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode Mailing List
Eric Schulte <eric.schulte@gmx.com> wrote:
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
> > Eric Schulte <eric.schulte@gmx.com> wrote:
> >
> >> Hi,
> >>
> >> I've been using the new html exporter (org-e-html) recently, and I'm
> >> surprised that it does not add tables of contents by default. Is there
> >> a user variable which I can customize to change this default? Currently
> >> the only way I see to add a table of contents is to add a TOC keyword to
> >> the buffer.
> >>
> >
> > org-export-with-toc perhaps?
> >
> > Nick
> >
>
> Nope,
>
> With this variable set to t the e-html backend does *not* produce a
> table of contents. To demonstrate, run the following from the command
> line with the attached Org-mode file (although any file will do) saved
> to /tmp/example.org.
>
> # -*- shell-script -*-
> emacs --batch -l path/to/org-mode/lisp/org-element.el \
> -l path/to/org-mode/contrib/lisp/org-export.el \
> -l path/to/org-mode/contrib/lisp/org-e-html.el \
> /tmp/example.org \
> --eval '(let ((org-export-with-toc t)) (org-export-to-file (quote e-html) "/tmp/example.html"))'
Try setting it to 4: org-e-html.el says (around line 1475)
--8<---------------cut here---------------start------------->8---
;; table of contents
(let ((depth (plist-get info :with-toc)))
(when (wholenump depth) (org-e-html-toc depth info)))
--8<---------------cut here---------------end--------------->8---
even though that contradicts the docstring for the variable.
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 17:52 ` Nick Dokos
@ 2012-08-23 18:42 ` Eric Schulte
2012-08-23 19:29 ` Nick Dokos
0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2012-08-23 18:42 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <eric.schulte@gmx.com> wrote:
>
>> Nick Dokos <nicholas.dokos@hp.com> writes:
>>
>> > Eric Schulte <eric.schulte@gmx.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> I've been using the new html exporter (org-e-html) recently, and I'm
>> >> surprised that it does not add tables of contents by default. Is there
>> >> a user variable which I can customize to change this default? Currently
>> >> the only way I see to add a table of contents is to add a TOC keyword to
>> >> the buffer.
>> >>
>> >
>> > org-export-with-toc perhaps?
>> >
>> > Nick
>> >
>>
>> Nope,
>>
>> With this variable set to t the e-html backend does *not* produce a
>> table of contents. To demonstrate, run the following from the command
>> line with the attached Org-mode file (although any file will do) saved
>> to /tmp/example.org.
>>
>> # -*- shell-script -*-
>> emacs --batch -l path/to/org-mode/lisp/org-element.el \
>> -l path/to/org-mode/contrib/lisp/org-export.el \
>> -l path/to/org-mode/contrib/lisp/org-e-html.el \
>> /tmp/example.org \
>> --eval '(let ((org-export-with-toc t)) (org-export-to-file (quote e-html) "/tmp/example.html"))'
>
> Try setting it to 4: org-e-html.el says (around line 1475)
>
>
> --8<---------------cut here---------------start------------->8---
> ;; table of contents
> (let ((depth (plist-get info :with-toc)))
> (when (wholenump depth) (org-e-html-toc depth info)))
> --8<---------------cut here---------------end--------------->8---
>
> even though that contradicts the docstring for the variable.
>
Indeed, setting this variable to 4 does result in TOC generation.
I'd recommend the attached patch.
Thanks,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Better-use-of-default-org-export-with-toc-value.patch --]
[-- Type: text/x-patch, Size: 993 bytes --]
From 228c4bbdd2fc145b135de233632e8884d1d53cd7 Mon Sep 17 00:00:00 2001
From: Eric Schulte <eric.schulte@gmx.com>
Date: Thu, 23 Aug 2012 12:41:52 -0600
Subject: [PATCH] Better use of default org-export-with-toc value
* contrib/lisp/org-e-html.el (org-e-html-template): Default value of t
for org-export-with-toc has no impact, so instead when t set TOC depth
to 4.
---
contrib/lisp/org-e-html.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index 4e9d398..ee0f247 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -1473,6 +1473,7 @@ original parsed data. INFO is a plist holding export options."
<h1 class=\"title\">%s</h1>\n" (org-export-data (plist-get info :title) info))
;; table of contents
(let ((depth (plist-get info :with-toc)))
+ (when (eq t depth) (setq depth 4))
(when (wholenump depth) (org-e-html-toc depth info)))
;; document contents
contents
--
1.7.12
[-- Attachment #3: Type: text/plain, Size: 46 bytes --]
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 18:42 ` Eric Schulte
@ 2012-08-23 19:29 ` Nick Dokos
2012-08-23 19:39 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-08-23 19:29 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode Mailing List
Eric Schulte <eric.schulte@gmx.com> wrote:
> I'd recommend the attached patch.
>
> Thanks,
>
> From 228c4bbdd2fc145b135de233632e8884d1d53cd7 Mon Sep 17 00:00:00 2001
> From: Eric Schulte <eric.schulte@gmx.com>
> Date: Thu, 23 Aug 2012 12:41:52 -0600
> Subject: [PATCH] Better use of default org-export-with-toc value
>
> * contrib/lisp/org-e-html.el (org-e-html-template): Default value of t
> for org-export-with-toc has no impact, so instead when t set TOC depth
> to 4.
> ---
> contrib/lisp/org-e-html.el | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
> index 4e9d398..ee0f247 100644
> --- a/contrib/lisp/org-e-html.el
> +++ b/contrib/lisp/org-e-html.el
> @@ -1473,6 +1473,7 @@ original parsed data. INFO is a plist holding export options."
> <h1 class=\"title\">%s</h1>\n" (org-export-data (plist-get info :title) info))
> ;; table of contents
> (let ((depth (plist-get info :with-toc)))
> + (when (eq t depth) (setq depth 4))
> (when (wholenump depth) (org-e-html-toc depth info)))
> ;; document contents
> contents
In the t case, the depth should probably be set to org-export-headline-levels,
instead of 4.
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-e-html and table of contents
2012-08-23 19:29 ` Nick Dokos
@ 2012-08-23 19:39 ` Nicolas Goaziou
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2012-08-23 19:39 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Org Mode Mailing List, Jambunathan K, Eric Schulte
Hello,
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <eric.schulte@gmx.com> wrote:
>
>> I'd recommend the attached patch.
>>
>> Thanks,
>>
>> From 228c4bbdd2fc145b135de233632e8884d1d53cd7 Mon Sep 17 00:00:00 2001
>> From: Eric Schulte <eric.schulte@gmx.com>
>> Date: Thu, 23 Aug 2012 12:41:52 -0600
>> Subject: [PATCH] Better use of default org-export-with-toc value
>>
>> * contrib/lisp/org-e-html.el (org-e-html-template): Default value of t
>> for org-export-with-toc has no impact, so instead when t set TOC depth
>> to 4.
>> ---
>> contrib/lisp/org-e-html.el | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
>> index 4e9d398..ee0f247 100644
>> --- a/contrib/lisp/org-e-html.el
>> +++ b/contrib/lisp/org-e-html.el
>> @@ -1473,6 +1473,7 @@ original parsed data. INFO is a plist holding export options."
>> <h1 class=\"title\">%s</h1>\n" (org-export-data (plist-get info :title) info))
>> ;; table of contents
>> (let ((depth (plist-get info :with-toc)))
>> + (when (eq t depth) (setq depth 4))
>> (when (wholenump depth) (org-e-html-toc depth info)))
>> ;; document contents
>> contents
>
>
> In the t case, the depth should probably be set to org-export-headline-levels,
> instead of 4.
This should be fixed in master. Note that the #+TOC: support is still
incomplete.
Thanks for the report. Cc'ing Jambunathan for the heads up.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-08-23 19:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-23 1:55 org-e-html and table of contents Eric Schulte
2012-08-23 15:56 ` Nick Dokos
2012-08-23 16:41 ` Eric Schulte
2012-08-23 17:52 ` Nick Dokos
2012-08-23 18:42 ` Eric Schulte
2012-08-23 19:29 ` Nick Dokos
2012-08-23 19:39 ` Nicolas Goaziou
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).