From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: org-e-html and table of contents Date: Thu, 23 Aug 2012 12:42:31 -0600 Message-ID: <87ipc9fo14.fsf@gmx.com> References: <87d32h63lg.fsf@gmx.com> <11332.1345737403@alphaville> <871uix5znw.fsf@gmx.com> <3161.1345744363@alphaville> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4cn7-0005bA-Ld for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 15:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4cmx-0004sT-PY for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 15:10:05 -0400 Received: from mailout-us.gmx.com ([74.208.5.67]:34415) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1T4cmx-0004sL-If for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 15:09:55 -0400 In-Reply-To: <3161.1345744363@alphaville> (Nick Dokos's message of "Thu, 23 Aug 2012 13:52:43 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Org Mode Mailing List --=-=-= Content-Type: text/plain Nick Dokos writes: > Eric Schulte wrote: > >> Nick Dokos writes: >> >> > Eric Schulte 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, --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Better-use-of-default-org-export-with-toc-value.patch >From 228c4bbdd2fc145b135de233632e8884d1d53cd7 Mon Sep 17 00:00:00 2001 From: Eric Schulte 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."

%s

\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 --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--