emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* meaning of body-only in org-export-as-html
@ 2012-03-16 22:33 Chris Gray
  2012-03-22 14:51 ` Myles English
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Gray @ 2012-03-16 22:33 UTC (permalink / raw)
  To: emacs-orgmode

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 <body> 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?  

Cheers,
Chris

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

* Re: meaning of body-only in org-export-as-html
  2012-03-16 22:33 meaning of body-only in org-export-as-html Chris Gray
@ 2012-03-22 14:51 ` Myles English
  2012-03-31 22:47   ` [patch] " Chris Gray
  0 siblings, 1 reply; 8+ messages in thread
From: Myles English @ 2012-03-22 14:51 UTC (permalink / raw)
  To: Chris Gray; +Cc: emacs-orgmode Mode


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 <body> 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)?

  > Cheers, Chris

Myles

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

* [patch] Re:  meaning of body-only in org-export-as-html
  2012-03-22 14:51 ` Myles English
@ 2012-03-31 22:47   ` Chris Gray
  2012-04-02  8:07     ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Gray @ 2012-03-31 22:47 UTC (permalink / raw)
  To: Myles English; +Cc: emacs-orgmode Mode

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

Hi Myles,

Sorry I missed your email for so long.

On Thu, 22 Mar 2012 14:51:29 +0000, Myles English <mylesenglish@gmail.com> 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 <body> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Bring-the-meaning-of-body-only-in-org-export-as-html.patch --]
[-- Type: text/x-diff, Size: 1200 bytes --]

From 9f91361e8c8cd7047acf0260bff2ae81e72fcc93 Mon Sep 17 00:00:00 2001
From: Chris Gray <chrismgray@gmail.com>
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
<body>...</body>, 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<h1 class=\"title\">" title "</h1>\n"))
 
       ;; insert body
-      (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.9


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

* Re: [patch] Re:  meaning of body-only in org-export-as-html
  2012-03-31 22:47   ` [patch] " Chris Gray
@ 2012-04-02  8:07     ` Bastien
  2012-04-03 16:40       ` Chris Gray
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-04-02  8:07 UTC (permalink / raw)
  To: Chris Gray; +Cc: Myles English, emacs-orgmode

Hi Chris,

Chris Gray <chrismgray@gmail.com> writes:

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

I'm ready to apply this patch, but can you add a proper Emacs 
ChangeLog?

Thanks,

-- 
 Bastien

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

* Re: [patch] Re:  meaning of body-only in org-export-as-html
  2012-04-02  8:07     ` Bastien
@ 2012-04-03 16:40       ` Chris Gray
  2012-04-03 18:12         ` Bastien
  2012-04-04  7:06         ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Chris Gray @ 2012-04-03 16:40 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

Bastien <bzg@gnu.org> writes:
> I'm ready to apply this patch, but can you add a proper Emacs 
> ChangeLog?

Updated patch attached.

By the way, I am in the "Processing" section in the list of people who
have signed papers on Worg.  However, I received confirmation that my
papers went through a long time ago.  Should I correct Worg on this?

Cheers,
Chris


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Export-Allow-for-TOC-generation-if-body-only-is-set.patch --]
[-- Type: text/x-diff, Size: 1130 bytes --]

From 3ae7de6bd5b91ce18ed38dfce46466d6dd3a64b7 Mon Sep 17 00:00:00 2001
From: Chris Gray <chrismgray@gmail.com>
Date: Tue, 3 Apr 2012 10:32:56 -0600
Subject: [PATCH] Export: Allow for TOC generation if body-only is set

* lisp/org-html.el (org-export-as-html): Remove the check for
body-only in the code for generating tables of contents.

The docstring for org-export-as-html states that the body-only flag
removes everything outside the <body></body> tags (inclusive).  Since
the table of contents is inside these tags, it should be exported when
requested even if the body-only flag is set.
---
 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 be2124b..385d8ec 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1414,7 +1414,7 @@ PUB-DIR is set, use this as the publishing directory."
 		"\n<h1 class=\"title\">" title "</h1>\n"))
 
       ;; insert body
-      (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.9


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

* Re: [patch] Re:  meaning of body-only in org-export-as-html
  2012-04-03 16:40       ` Chris Gray
@ 2012-04-03 18:12         ` Bastien
  2012-04-04  7:06         ` Bastien
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2012-04-03 18:12 UTC (permalink / raw)
  To: Chris Gray; +Cc: emacs-orgmode

Chris Gray <chrismgray@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>> I'm ready to apply this patch, but can you add a proper Emacs 
>> ChangeLog?
>
> Updated patch attached.

Thanks, I will review it.

> By the way, I am in the "Processing" section in the list of people who
> have signed papers on Worg.  However, I received confirmation that my
> papers went through a long time ago.  Should I correct Worg on this?

Yes, please go ahead!

Thanks,

-- 
 Bastien

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

* Re: [patch] Re:  meaning of body-only in org-export-as-html
  2012-04-03 16:40       ` Chris Gray
  2012-04-03 18:12         ` Bastien
@ 2012-04-04  7:06         ` Bastien
  2012-04-04 18:24           ` Chris Gray
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien @ 2012-04-04  7:06 UTC (permalink / raw)
  To: Chris Gray; +Cc: emacs-orgmode

Hi Chris,

Chris Gray <chrismgray@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>> I'm ready to apply this patch, but can you add a proper Emacs 
>> ChangeLog?
>
> Updated patch attached.

Applied, thanks for the effort in formatting/documenting it.

> By the way, I am in the "Processing" section in the list of people who
> have signed papers on Worg.  However, I received confirmation that my
> papers went through a long time ago.  Should I correct Worg on this?

Let me know when this is done.

Best,

-- 
 Bastien

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

* Re: [patch] Re:  meaning of body-only in org-export-as-html
  2012-04-04  7:06         ` Bastien
@ 2012-04-04 18:24           ` Chris Gray
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Gray @ 2012-04-04 18:24 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@gnu.org> writes:
>> By the way, I am in the "Processing" section in the list of people who
>> have signed papers on Worg.  However, I received confirmation that my
>> papers went through a long time ago.  Should I correct Worg on this?
>
> Let me know when this is done.

I did this yesterday.  It turned out that I was listed in two places:
once with my full name and once with the short name that I go by.  I
just removed my short name from the list.

Cheers,
Chris

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

end of thread, other threads:[~2012-04-04 18:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 22:33 meaning of body-only in org-export-as-html Chris Gray
2012-03-22 14:51 ` Myles English
2012-03-31 22:47   ` [patch] " Chris Gray
2012-04-02  8:07     ` Bastien
2012-04-03 16:40       ` Chris Gray
2012-04-03 18:12         ` Bastien
2012-04-04  7:06         ` Bastien
2012-04-04 18:24           ` Chris Gray

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