From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Gray Subject: [patch] Re: meaning of body-only in org-export-as-html Date: Sat, 31 Mar 2012 16:47:02 -0600 Message-ID: <87obrcie1l.fsf@gmail.com> References: <87k42k18i5.fsf@gmail.com> <87haxgheoe.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE74h-0004cU-Ku for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 18:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SE74f-0000kS-R3 for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 18:47:11 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:55536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE74f-0000h2-Hv for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 18:47:09 -0400 Received: by pbcup15 with SMTP id up15so3280080pbc.0 for ; Sat, 31 Mar 2012 15:47:06 -0700 (PDT) In-Reply-To: <87haxgheoe.fsf@gmail.com> 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: Myles English Cc: emacs-orgmode Mode --=-=-= Content-Type: text/plain Hi Myles, Sorry I missed your email for so long. On Thu, 22 Mar 2012 14:51:29 +0000, Myles English wrote: > > Hi Chris, > > >> On Fri, 16 Mar 2012 16:33:22 -0600, Chris Gray said: > > > Hello, I am using org-export-as-html with the body-only parameter > > set to t in the org plugin for ikiwiki that I'm working on. It > > works almost perfectly, but I recently had a user point out that > > it's not possible to get a table of contents, even when one is > > explicitly asked for in the #+OPTIONS line of the org file. > > > Since the table of contents is part of the body (at least in the > > sense that it is between the tags), I found this surprising. > > So would it cause problems to change the line > > > (if (and org-export-with-toc (not body-only)) ...) > > > to > > > (if org-export-with-toc ...) > > > in org-export-as-html? > > I see one problem in that it would be then be inconsistent with > org-export-as-ascii which considers the TOC to be part of the header. I > would like to be able to export just the TOC (as ascii, and I understand > a new ascii exporter has been written lately). The same thing for the > html exporter would presumably solve your problem too because then you > could export TOC+body (as html)? The thing is, the docstring is not consistent with the code. It would make my life easier if the code was changed to match the docstring, but I would also be okay if the opposite happened. I am also looking forward to the new exporter being ready, but I guess this small issue should be fixed in the current exporter until it is. I have attached the patch that I suggested for the HTML exporter. Cheers, Chris --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Bring-the-meaning-of-body-only-in-org-export-as-html.patch >From 9f91361e8c8cd7047acf0260bff2ae81e72fcc93 Mon Sep 17 00:00:00 2001 From: Chris Gray Date: Sat, 31 Mar 2012 16:35:04 -0600 Subject: [PATCH] Bring the meaning of body-only in org-export-as-html closer to docs The docstring for org-export-as-html says "When BODY-ONLY is set, don't produce the file header and footer, simply return the content of ..., without even the body tags themselves." However, it currently also inhibits the generation of the table of contents, regardless if one is asked for by the user in the #+OPTIONS line of the file. This patch fixes that (i.e. allows for toc generation if it is requested). --- lisp/org-html.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 2de2ea9..cb785f3 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1402,7 +1402,7 @@ PUB-DIR is set, use this as the publishing directory." "\n

" title "

\n")) ;; insert body - (if (and org-export-with-toc (not body-only)) + (if org-export-with-toc (progn (push (format "%s\n" org-export-html-toplevel-hlevel -- 1.7.9 --=-=-=--