emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Why does org-html.org refuse to export a table of contents when body-only is t?
@ 2010-04-18 17:32 Jan Böcker
  2010-04-27  9:55 ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Böcker @ 2010-04-18 17:32 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

Hi all,

I'd like to add a table of contents to a HTML export with body-only set
to t (to feed into jekyll later), but org-html.el automatically disables
the TOC when body-only is given.

I have used the attached one-line patch without any problems, the (still
XHTML strict compliant) result can be seen here:

http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.html

gitk tells me that the line I have changed was first introduced in
Release 4.75, so is this just a use case that was not thought of when
this was programmed, or is there a specific reason?

Curious,
  Jan

[-- Attachment #2: 0001-Allow-including-a-table-of-contents-in-a-body-only-e.patch --]
[-- Type: text/plain, Size: 787 bytes --]

From bdd811611e4a3cd637b0bae22e9d574846acddc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20B=C3=B6cker?= <jan.boecker@jboecker.de>
Date: Fri, 16 Apr 2010 10:17:49 +0200
Subject: [PATCH] Allow including a table of contents in a body-only export

---
 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 74f3a55..ab1aac2 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -807,7 +807,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (if title (insert (format org-export-html-title-format
 				    (org-html-expand title))))))
 
-      (if (and org-export-with-toc (not body-only))
+      (if org-export-with-toc
 	  (progn
 	    (push (format "<h%d>%s</h%d>\n"
 			  org-export-html-toplevel-hlevel
-- 
1.7.0.3


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Why does org-html.org refuse to export a table of contents when body-only is t?
  2010-04-18 17:32 Why does org-html.org refuse to export a table of contents when body-only is t? Jan Böcker
@ 2010-04-27  9:55 ` Carsten Dominik
  2010-04-27 16:59   ` David Maus
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2010-04-27  9:55 UTC (permalink / raw)
  To: Jan Böcker; +Cc: Org Mode


On Apr 18, 2010, at 7:32 PM, Jan Böcker wrote:

> Hi all,
>
> I'd like to add a table of contents to a HTML export with body-only  
> set
> to t (to feed into jekyll later), but org-html.el automatically  
> disables
> the TOC when body-only is given.
>
> I have used the attached one-line patch without any problems, the  
> (still
> XHTML strict compliant) result can be seen here:
>
> http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.html
>
> gitk tells me that the line I have changed was first introduced in
> Release 4.75, so is this just a use case that was not thought of when
> this was programmed, or is there a specific reason?


The reason for this behavior is that the most frequent
application for this seems to me to convert a small
block to HTML, to paste it somewhere else.

But I have no string reasons to keep it like this.  Do we have more
opinions on this issue?

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does org-html.org refuse to export a table of contents when body-only is t?
  2010-04-27  9:55 ` Carsten Dominik
@ 2010-04-27 16:59   ` David Maus
  2010-05-14  7:15     ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: David Maus @ 2010-04-27 16:59 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 1554 bytes --]

At Tue, 27 Apr 2010 11:55:44 +0200,
Carsten Dominik wrote:
> 
> 
> On Apr 18, 2010, at 7:32 PM, Jan Böcker wrote:
> 
> > Hi all,
> >
> > I'd like to add a table of contents to a HTML export with body-only  
> > set
> > to t (to feed into jekyll later), but org-html.el automatically  
> > disables
> > the TOC when body-only is given.
> >
> > I have used the attached one-line patch without any problems, the  
> > (still
> > XHTML strict compliant) result can be seen here:
> >
> > http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.html
> >
> > gitk tells me that the line I have changed was first introduced in
> > Release 4.75, so is this just a use case that was not thought of when
> > this was programmed, or is there a specific reason?
> 
> 
> The reason for this behavior is that the most frequent
> application for this seems to me to convert a small
> block to HTML, to paste it somewhere else.
> 
> But I have no string reasons to keep it like this.  Do we have more
> opinions on this issue?

Yes, the prospected exporter to atom uses body only to create html
markup for a atom feed entry where it normally makes no sense to
publish a table of contents.  Same is true for org-mime and the "Send
html messages with Wanderlust" hack.

So maybe create a body without toc when body-only is set to t and
create a body with toc when body-only is the symbol 'include-toc.

HTH
 -- David

-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does org-html.org refuse to export a table of contents when body-only is t?
  2010-04-27 16:59   ` David Maus
@ 2010-05-14  7:15     ` Carsten Dominik
  2010-05-17 13:49       ` Ian Barton
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2010-05-14  7:15 UTC (permalink / raw)
  To: David Maus; +Cc: Org Mode


On Apr 27, 2010, at 6:59 PM, David Maus wrote:

> At Tue, 27 Apr 2010 11:55:44 +0200,
> Carsten Dominik wrote:
>>
>>
>> On Apr 18, 2010, at 7:32 PM, Jan Böcker wrote:
>>
>>> Hi all,
>>>
>>> I'd like to add a table of contents to a HTML export with body-only
>>> set
>>> to t (to feed into jekyll later), but org-html.el automatically
>>> disables
>>> the TOC when body-only is given.
>>>
>>> I have used the attached one-line patch without any problems, the
>>> (still
>>> XHTML strict compliant) result can be seen here:
>>>
>>> http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.html
>>>
>>> gitk tells me that the line I have changed was first introduced in
>>> Release 4.75, so is this just a use case that was not thought of  
>>> when
>>> this was programmed, or is there a specific reason?
>>
>>
>> The reason for this behavior is that the most frequent
>> application for this seems to me to convert a small
>> block to HTML, to paste it somewhere else.
>>
>> But I have no string reasons to keep it like this.  Do we have more
>> opinions on this issue?
>
> Yes, the prospected exporter to atom uses body only to create html
> markup for a atom feed entry where it normally makes no sense to
> publish a table of contents.  Same is true for org-mime and the "Send
> html messages with Wanderlust" hack.

I think we should keep it the way it is, and Jan, maybe you can just  
strip the surrounding stuff yourself, using a hook.

best wishes

- Carsten

>
> So maybe create a body without toc when body-only is set to t and
> create a body with toc when body-only is the symbol 'include-toc.
>
> HTH
> -- David
>
> -- 
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does org-html.org refuse to export a table of contents when body-only is t?
  2010-05-14  7:15     ` Carsten Dominik
@ 2010-05-17 13:49       ` Ian Barton
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Barton @ 2010-05-17 13:49 UTC (permalink / raw)
  To: emacs-orgmode

>>>>
>>>> I'd like to add a table of contents to a HTML export with body-only
>>>> set
>>>> to t (to feed into jekyll later), but org-html.el automatically
>>>> disables
>>>> the TOC when body-only is given.
>>>>
>>>> I have used the attached one-line patch without any problems, the
>>>> (still
>>>> XHTML strict compliant) result can be seen here:
>>>>
>>>> http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.html
>>>>
>>>>
I have just run into the same problem, also using Jekyll. However, I 
have managed to generate a TOC using jQuery and a jQuery plugin. This 
turns out to be more flexible than using org directly. I can post more 
details if it's of any interest.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-17 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-18 17:32 Why does org-html.org refuse to export a table of contents when body-only is t? Jan Böcker
2010-04-27  9:55 ` Carsten Dominik
2010-04-27 16:59   ` David Maus
2010-05-14  7:15     ` Carsten Dominik
2010-05-17 13:49       ` Ian Barton

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).