Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-17 Thread Bastien
Hi Jason,

Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 Set :html-preamble to:

 div class=\menu\ \
 a href=\index.html\index/a :: \
 a href=\changelog.html\changelog/a :: \
 a href=\sitemap.html\sitemap/a \
 /div

 When I export as HTML with this config, I don't see an h1title/h1.
 Do you?

I don't -- and this is on purpose.  

 Previously, :html-preamble could be set to a format string without
 h1%t/h1 and h1title/h1 would still be exported.

Previously, we had two variables controlling preamble(s): 

`org-export-html-preamble'
`org-export-html-auto-preamble'

the first one defaulted to nil, the last one to h1title/h1.

So setting `org-export-html-preamble' in any fashing would add a
preamble to the default one (controlled by :auto-preamble in a
publishing project).

You need to set :html-preamble to this:

,
| h1 class=\title\%t/h1
| 
| div class=\menu\ \
| a href=\index.html\index/a :: \
| a href=\changelog.html\changelog/a :: \
| a href=\sitemap.html\sitemap/a \
| /div
`

HTH,

-- 
 Bastien



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-15 Thread Bastien
Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 Applying the attached patch above the previous one should do.

 Let me know, thanks!

 This patch fixed that export error, 

FYI, I applied the two patches I sent.  

Best,

-- 
 Bastien



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-15 Thread Jason Dunsmore
Bastien b...@altern.org writes:

 Hi Jason,

 Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 This patch fixed that export error, but I'm still seeing the problems
 with exporting #+TITLE: in an h1 heading described at:

 http://article.gmane.org/gmane.emacs.orgmode/39100

 You mean that, without any :html-preamble and with
 ̀org-export-html-preamble' set to `t' (as it is by default in these
 patches), you don't see any h1title/h1 ?

If :html-preamble isn't set, I see an h1title/h1.  If it is set, but
without explicitly defining h1 class=\title\%t/h1 in
the :html-preamble string, there is no h1title/h1.  This is not how
it worked before the recent changes to html exporting (ie. previously it
wasn't necessary to explicitly define h1%t/h1 in the :html-preamble
string).  The previous behavior seems more consistent.

This is with the latest git version (commit b6b7057467b6b).

`org-export-html-preamble' is set to `t' in all my testing.

Regards,
Jason



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-15 Thread Bastien
Hi Jason,

Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 You mean that, without any :html-preamble and with
 ̀org-export-html-preamble' set to `t' (as it is by default in these
 patches), you don't see any h1title/h1 ?

 If :html-preamble isn't set, I see an h1title/h1.  

When :html-preamble in a publishing project, it falls back on
org-export-html-preamble, which defaults to `t'.

You need to set :html-preamble to nil so that the HTML export
doesn't insert h1title/h1.

 If it is set, 

(to what?)

 but without explicitly defining h1 class=\title\%t/h1 in the
 :html-preamble string, there is no h1title/h1.

When :html-preamble is set to `t' in a publishing project, and
org-export-html-preamble-format hasn't been modified, it should
insert h1 class=\title\%t/h1 -- it does here.  Can you give
an example I can test?

 This is not how
 it worked before the recent changes to html exporting (ie. previously it
 wasn't necessary to explicitly define h1%t/h1 in the :html-preamble
 string).  

It is not -- just check that org-export-html-preamble is `t' and that
should be all right.  In th recent changes, I tried to make sure that 
the defaults produce the same HTML output than defaults in 7.4.

 The previous behavior seems more consistent.

 This is with the latest git version (commit b6b7057467b6b).

 `org-export-html-preamble' is set to `t' in all my testing.

Thanks for this report again...

-- 
 Bastien



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-15 Thread Jason Dunsmore
Bastien b...@altern.org writes:

 Hi Jason,

 Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 You mean that, without any :html-preamble and with
 ̀org-export-html-preamble' set to `t' (as it is by default in these
 patches), you don't see any h1title/h1 ?

 If :html-preamble isn't set, I see an h1title/h1.  

 When :html-preamble in a publishing project, it falls back on
 org-export-html-preamble, which defaults to `t'.

 You need to set :html-preamble to nil so that the HTML export
 doesn't insert h1title/h1.

 If it is set, 

 (to what?)

 but without explicitly defining h1 class=\title\%t/h1 in the
 :html-preamble string, there is no h1title/h1.

 When :html-preamble is set to `t' in a publishing project, and
 org-export-html-preamble-format hasn't been modified, it should
 insert h1 class=\title\%t/h1 -- it does here.

Yes, the same happens for me.  The case I'm referring to is
when :html-preamble is set to a string.

 Can you give an example I can test?

Set :html-preamble to:

--8---cut here---start-8---
div class=\menu\ \
a href=\index.html\index/a :: \
a href=\changelog.html\changelog/a :: \
a href=\sitemap.html\sitemap/a \
/div
--8---cut here---end---8---

When I export as HTML with this config, I don't see an h1title/h1.
Do you?

Previously, :html-preamble could be set to a format string without
h1%t/h1 and h1title/h1 would still be exported.

Regards,
Jason



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-10 Thread Bastien
Hi Jason,

Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 Bastien b...@altern.org writes:

 Hopefully this patch will solve a few issues that have just been raised
 about the new behavior of org-export-html-preamble/postamble.

 With this patch, I get the following error when exporting to HTML:

 list: Symbol's value as variable is void: creator-info

Applying the attached patch above the previous one should do.

Let me know, thanks!

From 368ff7ba090a663e77cb90af2d89206af9201644 Mon Sep 17 00:00:00 2001
From: Bastien Guerry b...@altern.org
Date: Thu, 10 Mar 2011 10:26:37 +0100
Subject: [PATCH 2/2] * org-html.el: Bugfix: define email and creator-info before using them.

* org-html.el (org-export-as-html): Bugfix: define email and
creator-info before using them.

Thanks to Jason Dunsmore for catching this.
---
 lisp/org-html.el |   37 ++---
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/lisp/org-html.el b/lisp/org-html.el
index d5ea1a3..1661085 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1704,7 +1704,15 @@ lang=\%s\ xml:lang=\%s\
 
   ;; Export html postamble
   (unless body-only
-	(let ((html-post (plist-get opt-plist :html-postamble)))
+	(let ((html-post (plist-get opt-plist :html-postamble))
+	  ((email
+		(mapconcat (lambda(e)
+			 (format a href=\mailto:%s\%s/a e e))
+			   (split-string email ,+ *)
+			   , ))
+	   (creator-info
+		(concat Org version  org-version  with Emacs version 
+			(number-to-string emacs-major-version)
 	  (when (plist-get opt-plist :html-postamble)
 	(cond ((stringp html-post)
 		   (insert div id=\postamble\\n)
@@ -1717,25 +1725,16 @@ lang=\%s\ xml:lang=\%s\
 		   (funcall html-post opt-plist))
 		  ((eq html-post 'auto)
 		   ;; fall back on default postamble
-		   (let 
-		   ((email
-			 (mapconcat (lambda(e)
-  (format a href=\mailto:%s\%s/a e e))
-(split-string email ,+ *)
-, ))
-			(creator-info
-			 (concat Org version  org-version  with Emacs version 
- (number-to-string emacs-major-version
-		 (insert div id=\postamble\\n)
-		 (when (and (plist-get opt-plist :author-info) author)
+		   (insert div id=\postamble\\n)
+		   (when (and (plist-get opt-plist :author-info) author)
 		   (insert p class=\author\ (nth 1 lang-words) :  author /p\n))
-		 (when (and (plist-get opt-plist :email-info) email)
-		   (insert p class=\mailto: email \lt; email gt;/p\n))
-		 (when (plist-get opt-plist :creator-info)
-		   (insert p class=\creator\
-			   (concat Org version  org-version  with Emacs version 
-   (number-to-string emacs-major-version) /p\n)))
-		 (insert html-validation-link \n/div)))
+		   (when (and (plist-get opt-plist :email-info) email)
+		 (insert p class=\mailto: email \lt; email gt;/p\n))
+		   (when (plist-get opt-plist :creator-info)
+		 (insert p class=\creator\
+			 (concat Org version  org-version  with Emacs version 
+ (number-to-string emacs-major-version) /p\n)))
+		   (insert html-validation-link \n/div))
 		  (t 
 		   (insert div id=\postamble\\n)
 		   (insert (format-spec
-- 
1.7.4.1


-- 
 Bastien


Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-10 Thread Jason Dunsmore
Bastien b...@altern.org writes:

 Hi Jason,

 Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 Bastien b...@altern.org writes:

 Hopefully this patch will solve a few issues that have just been raised
 about the new behavior of org-export-html-preamble/postamble.

 With this patch, I get the following error when exporting to HTML:

 list: Symbol's value as variable is void: creator-info

 Applying the attached patch above the previous one should do.

 Let me know, thanks!

This patch fixed that export error, but I'm still seeing the problems
with exporting #+TITLE: in an h1 heading described at:

http://article.gmane.org/gmane.emacs.orgmode/39100



Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-10 Thread Bastien
Hi Jason,

Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 This patch fixed that export error, but I'm still seeing the problems
 with exporting #+TITLE: in an h1 heading described at:

 http://article.gmane.org/gmane.emacs.orgmode/39100

You mean that, without any :html-preamble and with
̀org-export-html-preamble' set to `t' (as it is by default in these
patches), you don't see any h1title/h1 ?

If so there is problem but I cannot reproduce it.

Otherwise, I'm not sure I completely understand.

Best,

-- 
 Bastien



[O] Rework org-export-html-preamble/postamble (again)

2011-03-09 Thread Bastien
Hopefully this patch will solve a few issues that have just been raised
about the new behavior of org-export-html-preamble/postamble.

`org-export-html-preamble' defaults back to `t', to reproduce the
previous default behavior.

`org-export-html-postamble' default to 'auto -- which mean that
org-export-email/author/creator-info will be honored by default.
When this is set to `t', the postamble will be inserted from the
formatting string in `org-export-html-postamble-format'.  When 
set to a string, this formatting string will be replaced by this
string.

Both variables also support functions, as org-export-html-preamble 
and org-export-html-postamble used to (but that wasn't documented).

Please test carefully and tell me if this is okay to apply.

Thanks!

From 990063c31f1f365667017b4780a347ff9dbdeb1c Mon Sep 17 00:00:00 2001
From: Bastien Guerry b...@altern.org
Date: Wed, 9 Mar 2011 17:13:40 +0100
Subject: [PATCH] Rework org-export-html-preamble/postamble (again).

* org-html.el (org-export-html-insert-plist-item): Remove.
(org-export-html-preamble): Default to `t'.  Accept functions.
(org-export-html-postamble): Default to `auto'.  Accept
functions and distinguish between 'auto (no formatting string)
and `t' (default formatting string).
(org-export-as-html): Handle org-export-html-preamble and
org-export-html-postamble new defaults/allowed values.
---
 lisp/org-html.el |  158 --
 1 files changed, 93 insertions(+), 65 deletions(-)

diff --git a/lisp/org-html.el b/lisp/org-html.el
index c60c90d..d5ea1a3 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -343,13 +343,22 @@ CSS classes, then this prefix can be very useful.
   :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-html-preamble nil
+(defcustom org-export-html-preamble t
   Non-nil means insert a preamble in HTML export.
-If this is a string, use it as a formatting string it instead of
-`org-export-html-preamble-format'.  Setting :html-preamble in
-publishing projects will override this.
+When `t', insert a string as defined by
+`org-export-html-preamble-format'.  When set to a string, this
+string overrides `org-export-html-preamble-format'.  When set to
+a function, apply this function and insert the returned string.
+The function takes the property list of export options as its
+only argument.
+
+Setting :html-preamble in publishing projects will take
+precedence over this variable.
   :group 'org-export-html
-  :type 'boolean)
+  :type '(choice (const :tag No preamble nil)
+		 (const :tag Default preamble t)
+		 (string :tag Custom formatting string)
+		 (function :tag Function (must return a string
 
 (defcustom org-export-html-preamble-format
   '((en h1 class=\title\%t/h1))
@@ -362,13 +371,26 @@ like that: \%%\.
   :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-html-postamble nil
+(defcustom org-export-html-postamble 'auto
   Non-nil means insert a postamble in HTML export.
-If this is a string, use it as a formatting string it instead of
-`org-export-html-postamble-format'.  Setting :html-postamble in
-publishing projects will override this.
+
+When `t', insert a string as defined by
+`org-export-html-postamble-format'.  When set to a string, this
+string overrides `org-export-html-postamble-format'.  When set to
+'auto, discard `org-export-html-postamble-format' and honor
+`org-export-author/email/creator-info' variables.  When set to a
+function, apply this function and insert the returned string.
+The function takes the property list of export options as its
+only argument.
+
+Setting :html-postamble in publishing projects will take
+precedence over this variable.
   :group 'org-export-html
-  :type 'boolean)
+  :type '(choice (const :tag No postamble nil)
+		 (const :tag Auto preamble 'auto)
+		 (const :tag Default formatting string t)
+		 (string :tag Custom formatting string)
+		 (function :tag Function (must return a string
 
 (defcustom org-export-html-postamble-format
   '((en p class=\author\Author: %a (%e)/p
@@ -1277,19 +1299,23 @@ lang=\%s\ xml:lang=\%s\
 		   )))
 
 	;; insert html preamble
-	(if (plist-get opt-plist :html-preamble)
-	(let* ((html-preamble (plist-get opt-plist :html-preamble))
-		   (html-preamble-format
-		(if (stringp html-preamble)
-			html-preamble
-		  (cadr (or (assoc (nth 0 lang-words)
-   org-export-html-preamble-format)
-(assoc en org-export-html-preamble-format))
-	  (insert (format-spec html-preamble-format
-   `((?t . ,title)
- (?a . ,author) (?d . ,date) (?e . ,email)
-	  (insert  h1 class=\title\ title /h1)))
-  
+	(when (plist-get opt-plist :html-preamble)
+	  (let ((html-pre (plist-get opt-plist :html-preamble)))
+	(cond ((stringp html-pre)
+		   (insert
+		(format-spec html-pre `((?t . ,title) (?a . ,author) 
+	(?d . ,date) (?e . ,email)
+		  ((functionp html-pre)
+		   (funcall html-pre opt-plist))
+		  (t
+		   (insert 

Re: [O] Rework org-export-html-preamble/postamble (again)

2011-03-09 Thread Jason Dunsmore
Bastien b...@altern.org writes:

 Hopefully this patch will solve a few issues that have just been raised
 about the new behavior of org-export-html-preamble/postamble.

With this patch, I get the following error when exporting to HTML:

list: Symbol's value as variable is void: creator-info