From: Rick Frankel <rick@rickster.com>
To: Jay Dixit <jaydixit.work@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-slidy and other HTML slideshows in org 8.x?
Date: Thu, 24 Oct 2013 12:04:19 -0400 [thread overview]
Message-ID: <6ae67700784bd483c4ad4be27cb9f8ef@mail.rickster.com> (raw)
In-Reply-To: <CAGE7GqD0qZKjNV_rRO0_O_J=sc98K7zB8USKHUcgY7KOhTMWnw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
On 2013-10-23 23:12, Jay Dixit wrote:
> Hey everyone,
>
> I'm trying to use Dov Grobgeld's org-slidy
> (https://github.com/dov/org-slidy [1]) to create HTML-based slideshows
> using org-mode, but it doesn't seem to be working. I'm not sure, but I
> suspect this is because the syntax for org's HTML export may have
> changed?
>
Attached is a quick hack --- ox-slidy.el, an org 8 exporter which
inherits from ox-s5.
It has a lot of stuff hardcoded that should be variables, but it works.
rick
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-slidy.el --]
[-- Type: text/x-lisp; name=ox-slidy.el, Size: 6097 bytes --]
(require 'ox-s5)
(org-export-define-derived-backend 'slidy 's5
:menu-entry
'(?S "Export to SLIDY HTML Presentation"
((?H "To temporary buffer" org-slidy-export-as-html)
(?h "To file" org-slidy-export-to-html)
(?o "To file and open"
(lambda (a s v b)
(if a (org-slidy-export-to-html t s v b)
(org-open-file (org-slidy-export-to-html nil s v b)))))))
:options-alist
'((:html-link-home "HTML_LINK_HOME" nil nil)
(:html-link-up "HTML_LINK_UP" nil nil)
(:slidy-background "SLIDY_BACKGROUND" nil org-slidy-background newline)
(:html-head-include-default-style "HTML_INCLUDE_DEFAULT_STYLE" nil nil)
(:html-head-include-scripts "HTML_INCLUDE_SCRIPTS" nil nil))
:translate-alist
'((template . org-slidy-template)))
(defgroup org-export-slidy nil
"Options for exporting Org mode files to Slidy HTML Presentations."
:tag "Org Export Slidy"
:group 'org-export-html)
(defcustom org-slidy-background
"<img id=\"head-icon\" alt=\"graphic with four colored squares\"
src=\"http://www.w3.org/Talks/Tools/Slidy2/graphics/icon-blue.png\" />"
"Contents for the background div"
:group 'org-export-slidy
:type 'string)
(defcustom org-slidy-style
"http://www.w3.org/Talks/Tools/Slidy2/styles/w3c-blue.css"
"Slidy theme stylesheet url."
:group 'org-export-slidy
:type 'string)
(defun org-slidy-template (contents info)
"Return complete document string after HTML conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
(let ((org-html--pre/postamble-class "background")
(info (plist-put
(plist-put info :html-preamble (plist-get info :slidy-background))
:html-postamble nil)))
(mapconcat
'identity
(list
(org-html-doctype info)
(format "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\">"
(plist-get info :language) (plist-get info :language))
"<head>"
"<link rel='stylesheet'"
" href='http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css'"
" media='screen, projection, print'"
" type='text/css' />"
(when org-slidy-style
(format "<link rel='%s' type='%s' media='%s' href='%s' />"
"stylesheet" "text/css" "screen, projection, print"
org-slidy-style))
"<script src='http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js'"
" type='text/javascript'></script>"
(org-html--build-meta-info info)
(org-html--build-head info)
(org-html--build-mathjax-config info)
"</head>"
"<body>"
(org-html--build-pre/postamble 'preamble info)
(org-html--build-pre/postamble 'postamble info)
(format "<%s id=\"%s\" class=\"presentation\">"
(nth 1 (assq 'content org-html-divs))
(nth 2 (assq 'content org-html-divs)))
;; title page
(format "<%s id='title-slide' class='slide cover'>"
(plist-get info :html-container))
(format-spec org-s5-title-slide-template (org-html-format-spec info))
(format "</%s>" (plist-get info :html-container))
;; table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth (org-slidy-toc depth info)))
contents
(format "</%s>" (nth 1 (assq 'content org-html-divs)))
"</body>"
"</html>\n") "\n")))
(defun org-slidy-export-as-html
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to an HTML buffer.
If narrowing is active in the current buffer, only export its
narrowed part.
If a region is active, export that region.
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting buffer should be accessible
through the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
When optional argument BODY-ONLY is non-nil, only write code
between \"<body>\" and \"</body>\" tags.
EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
Export is done in a buffer named \"*Org SLIDY Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(org-export-to-buffer 'slidy "*Org SLIDY Export*"
async subtreep visible-only body-only ext-plist (lambda () (nxml-mode))))
(defun org-slidy-export-to-html
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a SLIDY HTML file.
If narrowing is active in the current buffer, only export its
narrowed part.
If a region is active, export that region.
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
When optional argument BODY-ONLY is non-nil, only write code
between \"<body>\" and \"</body>\" tags.
EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
Return output file's name."
(interactive)
(let* ((extension (concat "." org-html-extension))
(file (org-export-output-file-name extension subtreep))
(org-export-coding-system org-html-coding-system))
(org-export-to-file 'slidy file
async subtreep visible-only body-only ext-plist)))
(defun org-slidy-publish-to-html (plist filename pub-dir)
"Publish an org file to SLIDY HTML Presentation.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
(org-publish-org-to 'slidy filename ".html" plist pub-dir))
(provide 'ox-slidy)
;;; ox-slidy.el ends here
next prev parent reply other threads:[~2013-10-24 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 3:12 org-slidy and other HTML slideshows in org 8.x? Jay Dixit
2013-10-24 9:41 ` Rasmus
2013-10-24 16:04 ` Rick Frankel [this message]
2013-10-24 23:41 ` Rick Frankel
2013-10-25 1:17 ` Rick Frankel
2013-10-25 14:19 ` Rick Frankel
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ae67700784bd483c4ad4be27cb9f8ef@mail.rickster.com \
--to=rick@rickster.com \
--cc=emacs-orgmode@gnu.org \
--cc=jaydixit.work@gmail.com \
/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 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).