From: Robert Klein <kleinrob@mpip-mainz.mpg.de>
To: emacs-orgmode@gnu.org
Subject: Patch: HTML body onload/onunload attribute support for new exporter
Date: Wed, 17 Oct 2012 15:20:40 +0200 [thread overview]
Message-ID: <507EB0A8.4020903@mpip-mainz.mpg.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
Hallo,
I created a patch for the new exporter, so I can adding onload and
onunload attributes to the body tag in HTML export.
I'm rather new to emacs lisp, please check if this is to be included in
org-mode.
Best regards
Robert
--
Robert Klein - Max Planck-Institut für Polymerforschung
Ackermannweg 10
55128 Mainz
[-- Attachment #2: html-e-body-onload.diff --]
[-- Type: text/x-patch, Size: 2276 bytes --]
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index fcdf006..78582a5 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -132,7 +132,9 @@
(:html-table-tag nil nil org-e-html-table-tag)
(:xml-declaration nil nil org-e-html-xml-declaration)
(:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)
- (:mathjax "MATHJAX" nil "" space)))
+ (:mathjax "MATHJAX" nil "" space)
+ (:html-body-onload nil nil org-e-html-body-onload)
+ (:html-body-onunload nil nil org-e-html-body-onunload)))
\f
@@ -996,6 +998,33 @@ CSS classes, then this prefix can be very useful."
:type 'string)
+;;;; Template :: body-onload
+
+(defcustom org-e-html-body-onload nil
+ "Additional onload attribute for HTML body tags.
+The value of this variable is inserted in a onload attribute of
+the body tag in the HTML buffer. Use this variable to include
+script code to be executed after loading the HTML page."
+ :group 'org-export-e-html
+ :type '(choice
+ (const :tag "No preamble" nil)
+ ((string ) :tag "Custom string")))
+
+
+;;;; Template :: body-onunload
+
+(defcustom org-e-html-body-onunload nil
+ "Additional onunload attribute for HTML body tags.
+The value of this variable is inserted in a onunload attribute of
+the body tag in the HTML buffer. Use this variable to include
+script code to be executed when leaving the HTML page."
+ :group 'org-export-e-html
+ :type '(choice
+ (const :tag "No preamble" nil)
+ ((string ) :tag "Custom string")))
+
+
+
\f
;;; Internal Functions
@@ -1422,7 +1451,16 @@ holding export options."
(org-e-html--build-style info)
(org-e-html--build-mathjax-config info)
"</head>\n"
- "<body>\n"
+ "<body"
+ (let ((body-onload (plist-get info :html-body-onload)))
+ (when body-onload
+ (if (stringp body-onload)
+ (format " onload=\"%s\"" body-onload))))
+ (let ((body-onunload (plist-get info :html-body-onunload)))
+ (when body-onunload
+ (if (stringp body-onunload)
+ (format " onunload=\"%s\"" body-onunload))))
+ ">\n"
(let ((link-up (org-trim (plist-get info :link-up)))
(link-home (org-trim (plist-get info :link-home))))
(unless (and (string= link-up "") (string= link-up ""))
next reply other threads:[~2012-10-17 13:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 13:20 Robert Klein [this message]
2012-10-17 13:50 ` Patch: HTML body onload/onunload attribute support for new exporter Nicolas Goaziou
2012-10-18 9:42 ` Robert Klein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=507EB0A8.4020903@mpip-mainz.mpg.de \
--to=kleinrob@mpip-mainz.mpg.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.