ox-deck.el 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. ;;; ox-deck.el --- deck.js Presentation Back-End for Org Export Engine
  2. ;; Copyright (C) 2013 Rick Frankel
  3. ;; Author: Rick Frankel <emacs at rickster dot com>
  4. ;; Keywords: outlines, hypermedia, slideshow
  5. ;; This file is not part of GNU Emacs.
  6. ;; This program is free software; you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation, either version 3 of the License, or
  9. ;; (at your option) any later version.
  10. ;; This program is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;; This library implements a deck.js presentation back-end for the Org
  18. ;; generic exporter.
  19. ;; Installation
  20. ;; -------------
  21. ;; Get a copy of deck.js from http://imakewebthings.com/deck.js/ or
  22. ;; the gitub repository at https://github.com/imakewebthings/deck.js.
  23. ;;
  24. ;; Add the path to the extracted code to the variable
  25. ;; `org-deck-directories' There are a number of customization in the
  26. ;; org-export-deck group, most of which can be overrriden with buffer
  27. ;; local customization (starting with DECK_.)
  28. ;; See ox.el and ox-html.el for more details on how this exporter
  29. ;; works (it is derived from ox-html.)
  30. (require 'ox-html)
  31. (eval-when-compile (require 'cl))
  32. (org-export-define-derived-backend deck html
  33. :menu-entry
  34. (?d "Export to deck.js HTML Presentation"
  35. ((?H "To temporary buffer" org-deck-export-as-html)
  36. (?h "To file" org-deck-export-to-html)
  37. (?o "To file and open"
  38. (lambda (a s v b)
  39. (if a (org-deck-export-to-html t s v b)
  40. (org-open-file (org-deck-export-to-html nil s v b)))))))
  41. :options-alist
  42. ((:html-link-home "HTML_LINK_HOME" nil nil)
  43. (:html-link-up "HTML_LINK_UP" nil nil)
  44. (:deck-postamble "DECK_POSTAMBLE" nil org-deck-postamble newline)
  45. (:deck-preamble "DECK_PREAMBLE" nil org-deck-preamble newline)
  46. (:html-head-include-default-style "HTML_INCLUDE_DEFAULT_STYLE" nil nil)
  47. (:html-head-include-scripts "HTML_INCLUDE_SCRIPTS" nil nil)
  48. (:deck-base-url "DECK_BASE_URL" nil org-deck-base-url)
  49. (:deck-theme "DECK_THEME" nil org-deck-theme)
  50. (:deck-transition "DECK_TRANSITION" nil org-deck-transition)
  51. (:deck-include-extensions "DECK_INCLUDE_EXTENSIONS" nil
  52. org-deck-include-extensions split)
  53. (:deck-exclude-extensions "DECK_EXCLUDE_EXTENSIONS" nil
  54. org-deck-exclude-extensions split))
  55. :translate-alist
  56. ((headline . org-deck-headline)
  57. (inner-template . org-deck-inner-template)
  58. (item . org-deck-item)
  59. (template . org-deck-template)))
  60. (defgroup org-export-deck nil
  61. "Options for exporting Org mode files to deck.js HTML Presentations."
  62. :tag "Org Export DECK"
  63. :group 'org-export-html)
  64. (defcustom org-deck-directories '("./deck.js")
  65. "Directories to search for deck.js components (jquery,
  66. modernizr; core, extensions and themes directories.)"
  67. :group 'org-export-deck
  68. :type '(repeat (string :tag "Directory")))
  69. (defun org-deck--cleanup-components (components)
  70. (remove-duplicates
  71. (car (remove 'nil components))
  72. :test (lambda (x y)
  73. (string= (file-name-nondirectory x)
  74. (file-name-nondirectory y)))))
  75. (defun org-deck--find-extensions ()
  76. "Returns a unique list of all extensions found in
  77. in the extensions directories under `org-deck-directories'"
  78. (org-deck--cleanup-components
  79. (mapcar ; extensions under existing dirs
  80. (lambda (dir)
  81. (when (file-directory-p dir) (directory-files dir t "^[^.]")))
  82. (mapcar ; possible extension directories
  83. (lambda (x) (expand-file-name "extensions" x))
  84. org-deck-directories))))
  85. (defun org-deck--find-css (type)
  86. "Return a unique list of all the css stylesheets in the themes/TYPE
  87. directories under `org-deck-directories'."
  88. (org-deck--cleanup-components
  89. (mapcar
  90. (lambda (dir)
  91. (let ((css-dir (expand-file-name
  92. (concat (file-name-as-directory "themes") type) dir)))
  93. (when (file-directory-p css-dir)
  94. (directory-files css-dir t "\\.css$"))))
  95. org-deck-directories)))
  96. (defun org-deck-list-components ()
  97. "List all available deck extensions, styles and
  98. transitions (with full paths) to a temporary buffer."
  99. (interactive)
  100. (let ((outbuf (get-buffer-create "*deck.js Extensions*")))
  101. (with-current-buffer outbuf
  102. (erase-buffer)
  103. (insert "Extensions\n----------\n")
  104. (insert (mapconcat 'identity (org-deck--find-extensions) "\n"))
  105. (insert "\n\nStyles\n------\n")
  106. (insert (mapconcat 'identity (org-deck--find-css "style") "\n"))
  107. (insert "\n\nTransitions\n----------\n")
  108. (insert (mapconcat 'identity (org-deck--find-css "transition") "\n")))
  109. (switch-to-buffer-other-window outbuf)))
  110. (defcustom org-deck-include-extensions nil
  111. "If non-nil, list of extensions to include instead of all available.
  112. Can be overriden or set with the DECK_INCLUDE_EXTENSIONS property.
  113. During output generation, the extensions found by
  114. `org-deck--find-extensions' are searched for the appropriate
  115. files (scripts and/or stylesheets) to include in the generated
  116. html. The href/src attributes are created relative to `org-deck-base-url'."
  117. :group 'org-export-deck
  118. :type '(repeat (string :tag "Extension")))
  119. (defcustom org-deck-exclude-extensions nil
  120. "If non-nil, list of extensions to exclude.
  121. Can be overriden or set with the DECK_EXCLUDE_EXTENSIONS property."
  122. :group 'org-export-deck
  123. :type '(repeat (string :tag "Extension")))
  124. (defcustom org-deck-theme "swiss.css"
  125. "deck.js theme. Can be overriden with the DECK_THEME property.
  126. If this value contains a path component (\"/\"), it is used as a
  127. literal path (url). Otherwise it is prepended with
  128. `org-deck-base-url'/themes/style/."
  129. :group 'org-export-deck
  130. :type 'string)
  131. (defcustom org-deck-transition "fade.css"
  132. "deck.js transition theme. Can be overriden with the
  133. DECK_TRANSITION property.
  134. If this value contains a path component (\"/\"), it is used as a
  135. literal path (url). Otherwise it is prepended with
  136. `org-deck-base-url'/themes/transition/."
  137. :group 'org-export-deck
  138. :type 'string)
  139. (defcustom org-deck-base-url "deck.js"
  140. "Url prefix to deck.js base directory containing the core, extensions
  141. and themes directories.
  142. Can be overriden with the DECK_BASE_URL property."
  143. :group 'org-export-deck
  144. :type 'string)
  145. (defvar org-deck-pre/postamble-styles
  146. `((both "left: 5px; width: 100%;")
  147. (preamble "position: absolute; top: 10px;")
  148. (postamble ""))
  149. "Alist of css styles for the preamble, postamble and both respectively.
  150. Can be overriden in `org-deck-styles'. See also `org-html-divs'.")
  151. (defcustom org-deck-postamble "<h1>%a - %t</h1>"
  152. "Non-nil means insert a postamble in HTML export.
  153. When set to a string, use this string
  154. as the postamble. When t, insert a string as defined by the
  155. formatting string in `org-html-postamble-format'.
  156. When set to a function, apply this function and insert the
  157. returned string. The function takes the property list of export
  158. options as its only argument.
  159. This is included in the document at the bottom of the content
  160. section, and uses the postamble element and id from
  161. `org-html-divs'. The default places the author and presentation
  162. title at the bottom of each slide.
  163. The css styling is controlled by `org-deck-pre/postamble-styles'.
  164. Setting :deck-postamble in publishing projects will take
  165. precedence over this variable."
  166. :group 'org-export-deck
  167. :type '(choice (const :tag "No postamble" nil)
  168. (const :tag "Default formatting string" t)
  169. (string :tag "Custom formatting string")
  170. (function :tag "Function (must return a string)")))
  171. (defcustom org-deck-preamble nil
  172. "Non-nil means insert a preamble in HTML export.
  173. When set to a string, use this string
  174. as the preamble. When t, insert a string as defined by the
  175. formatting string in `org-html-preamble-format'.
  176. When set to a function, apply this function and insert the
  177. returned string. The function takes the property list of export
  178. options as its only argument.
  179. This is included in the document at the top of content section, and
  180. uses the preamble element and id from `org-html-divs'. The css
  181. styling is controlled by `org-deck-pre/postamble-styles'.
  182. Setting :deck-preamble in publishing projects will take
  183. precedence over this variable."
  184. :group 'org-export-deck
  185. :type '(choice (const :tag "No preamble" nil)
  186. (const :tag "Default formatting string" t)
  187. (string :tag "Custom formatting string")
  188. (function :tag "Function (must return a string)")))
  189. (defvar org-deck-toc-styles
  190. (mapconcat
  191. 'identity
  192. (list
  193. "#table-of-contents a {color: inherit;}"
  194. "#table-of-contents ul {margin-bottom: 0;}"
  195. "#table-of-contents li {padding: 0;}") "\n")
  196. "Default css styles used for formatting a table of contents slide.
  197. Can be overriden in `org-deck-styles'.
  198. Note that when the headline numbering option is true, a \"list-style: none\"
  199. is automatically added to avoid both numbers and bullets on the toc entries.")
  200. (defcustom org-deck-styles
  201. "
  202. #title-slide h1 {
  203. position: static; padding: 0;
  204. margin-top: 10%;
  205. -webkit-transform: none;
  206. -moz-transform: none;
  207. -ms-transform: none;
  208. -o-transform: none;
  209. transform: none;
  210. }
  211. #title-slide h2 {
  212. text-align: center;
  213. border:none;
  214. padding: 0;
  215. margin: 0;
  216. }"
  217. "Deck specific CSS styles to include in exported html.
  218. Defaults to styles for the title page."
  219. :group 'org-export-deck
  220. :type 'string)
  221. (defcustom org-deck-title-slide-template
  222. "<h1>%t</h1>
  223. <h2>%a</h2>
  224. <h2>%e</h2>
  225. <h2>%d</h2>"
  226. "Format template to specify title page section.
  227. See `org-html-postamble-format' for the valid elements which
  228. can be included.
  229. It will be wrapped in the element defined in the :html-container
  230. property, and defaults to the value of `org-html-container-element',
  231. and have the id \"title-slide\"."
  232. :group 'org-export-deck
  233. :type 'string)
  234. (defun org-deck-toc (depth info)
  235. (concat
  236. (format "<%s id='table-of-contents' class='slide'>\n"
  237. (plist-get info :html-container))
  238. (format "<h2>%s</h2>\n" (org-html--translate "Table of Contents" info))
  239. (org-html--toc-text
  240. (mapcar
  241. (lambda (headline)
  242. (let* ((class (org-element-property :HTML_CONTAINER_CLASS headline))
  243. (section-number
  244. (when
  245. (and (not (org-export-low-level-p headline info))
  246. (org-export-numbered-headline-p headline info))
  247. (concat
  248. (mapconcat
  249. 'number-to-string
  250. (org-export-get-headline-number headline info) ".") ". ")))
  251. (title
  252. (concat
  253. section-number
  254. (replace-regexp-in-string ; remove any links in headline...
  255. "</?a[^>]*>" ""
  256. (org-export-data
  257. (org-element-property :title headline) info)))))
  258. (cons
  259. (if (and class (string-match-p "\\<slide\\>" class))
  260. (format
  261. "<a href='#outline-container-%s'>%s</a>"
  262. (or (org-element-property :CUSTOM_ID headline)
  263. (mapconcat
  264. 'number-to-string
  265. (org-export-get-headline-number headline info) "-"))
  266. title)
  267. title)
  268. (org-export-get-relative-level headline info))))
  269. (org-export-collect-headlines info depth)))
  270. (format "</%s>\n" (plist-get info :html-container))))
  271. (defun org-deck--get-packages (info)
  272. (let ((prefix (concat (plist-get info :deck-base-url) "/"))
  273. (theme (plist-get info :deck-theme))
  274. (transition (plist-get info :deck-transition))
  275. (include (plist-get info :deck-include-extensions))
  276. (exclude (plist-get info :deck-exclude-extensions))
  277. (scripts '()) (sheets '()) (snippets '()))
  278. (add-to-list 'scripts (concat prefix "jquery-1.7.2.min.js"))
  279. (add-to-list 'scripts (concat prefix "core/deck.core.js"))
  280. (add-to-list 'scripts (concat prefix "modernizr.custom.js"))
  281. (add-to-list 'sheets (concat prefix "core/deck.core.css"))
  282. (mapc
  283. (lambda (extdir)
  284. (let* ((name (file-name-nondirectory extdir))
  285. (dir (file-name-as-directory extdir))
  286. (path (concat prefix "extensions/" name "/"))
  287. (base (format "deck.%s." name)))
  288. (when (and (or (eq nil include) (member name include))
  289. (not (member name exclude)))
  290. (when (file-exists-p (concat dir base "js"))
  291. (add-to-list 'scripts (concat path base "js")))
  292. (when (file-exists-p (concat dir base "css"))
  293. (add-to-list 'sheets (concat path base "css")))
  294. (when (file-exists-p (concat dir base "html"))
  295. (add-to-list 'snippets (concat dir base "html"))))))
  296. (org-deck--find-extensions))
  297. (if (not (string-match-p "^[[:space:]]*$" theme))
  298. (add-to-list 'sheets
  299. (if (file-name-directory theme) theme
  300. (format "%sthemes/style/%s" prefix theme))))
  301. (if (not (string-match-p "^[[:space:]]*$" transition))
  302. (add-to-list
  303. 'sheets
  304. (if (file-name-directory transition) transition
  305. (format "%sthemes/transition/%s" prefix transition))))
  306. (list :scripts (nreverse scripts) :sheets (nreverse sheets)
  307. :snippets snippets)))
  308. (defun org-deck-inner-template (contents info)
  309. "Return body of document string after HTML conversion.
  310. CONTENTS is the transcoded contents string. INFO is a plist
  311. holding export options."
  312. (concat contents "\n"))
  313. (defun org-deck-headline (headline contents info)
  314. (let ((org-html-toplevel-hlevel 2)
  315. (class (or (org-element-property :HTML_CONTAINER_CLASS headline) ""))
  316. (level (org-export-get-relative-level headline info)))
  317. (when (and (= 1 level) (not (string-match-p "\\<slide\\>" class)))
  318. (org-element-put-property headline :HTML_CONTAINER_CLASS (concat class " slide")))
  319. (org-html-headline headline contents info)))
  320. (defun org-deck-item (item contents info)
  321. "Transcode an ITEM element from Org to HTML.
  322. CONTENTS holds the contents of the item. INFO is a plist holding
  323. contextual information.
  324. If the containing headline has the property :slide, then
  325. the \"slide\" class will be added to the to the list element,
  326. which will make the list into a \"build\"."
  327. (let ((text (org-html-item item contents info)))
  328. (if (org-export-get-node-property :STEP item t)
  329. (replace-regexp-in-string "^<li>" "<li class='slide'>" text)
  330. text)))
  331. (defun org-deck-template (contents info)
  332. "Return complete document string after HTML conversion.
  333. CONTENTS is the transcoded contents string. INFO is a plist
  334. holding export options."
  335. (let ((pkg-info (org-deck--get-packages info))
  336. (org-html--pre/postamble-class "deck-status")
  337. (info (plist-put
  338. (plist-put info :html-preamble (plist-get info :deck-preamble))
  339. :html-postamble (plist-get info :deck-postamble))))
  340. (mapconcat
  341. 'identity
  342. (list
  343. (plist-get info :html-doctype)
  344. (let ((lang (plist-get info :language)))
  345. (mapconcat
  346. (lambda (x)
  347. (apply
  348. 'format
  349. "<!--%s <html %s lang='%s' xmlns='http://www.w3.org/1999/xhtml'> %s<![endif]-->"
  350. x))
  351. (list `("[if lt IE 7]>" "class='no-js ie6'" ,lang "")
  352. `("[if IE 7]>" "class='no-js ie7'" ,lang "")
  353. `("[if IE 8]>" "class='no-js ie8'" ,lang "")
  354. `("[if gt IE 8]><!-->" "" ,lang "<!--")) "\n"))
  355. "<head>"
  356. (org-deck--build-meta-info info)
  357. (mapconcat
  358. (lambda (sheet)
  359. (format
  360. "<link rel='stylesheet' href='%s' type='text/css' />" sheet))
  361. (plist-get pkg-info :sheets) "\n")
  362. (mapconcat
  363. (lambda (script)
  364. (format
  365. "<script src='%s' type='text/javascript'></script>" script))
  366. (plist-get pkg-info :scripts) "\n")
  367. (org-html--build-mathjax-config info)
  368. "<script type='text/javascript'>"
  369. " $(document).ready(function () { $.deck('.slide'); });"
  370. "</script>"
  371. (org-html--build-head info)
  372. "<style type='text/css'>"
  373. org-deck-toc-styles
  374. (when (plist-get info :section-numbers)
  375. "#table-of-contents ul li {list-style-type: none;}")
  376. (format "#%s, #%s {%s}"
  377. (nth 2 (assq 'preamble org-html-divs))
  378. (nth 2 (assq 'postamble org-html-divs))
  379. (nth 1 (assq 'both org-deck-pre/postamble-styles)))
  380. (format "#%s {%s}"
  381. (nth 2 (assq 'preamble org-html-divs))
  382. (nth 1 (assq 'preamble org-deck-pre/postamble-styles)))
  383. (format "#%s {%s}"
  384. (nth 2 (assq 'postamble org-html-divs))
  385. (nth 1 (assq 'postamble org-deck-pre/postamble-styles)))
  386. org-deck-styles
  387. "</style>"
  388. "</head>"
  389. "<body>"
  390. (format "<%s id='%s' class='deck-container'>"
  391. (nth 1 (assq 'content org-html-divs))
  392. (nth 2 (assq 'content org-html-divs)))
  393. (org-html--build-pre/postamble 'preamble info)
  394. ;; title page
  395. (format "<%s id='title-slide' class='slide'>"
  396. (plist-get info :html-container))
  397. (format-spec org-deck-title-slide-template (org-html-format-spec info))
  398. (format "</%s>" (plist-get info :html-container))
  399. ;; toc page
  400. (let ((depth (plist-get info :with-toc)))
  401. (when depth (org-deck-toc depth info)))
  402. contents
  403. (mapconcat
  404. (lambda (snippet)
  405. (with-temp-buffer (insert-file-contents snippet)
  406. (buffer-string)))
  407. (plist-get pkg-info :snippets) "\n")
  408. (org-html--build-pre/postamble 'postamble info)
  409. (format "</%s>" (nth 1 (assq 'content org-html-divs)))
  410. "</body>"
  411. "</html>\n") "\n")))
  412. (defun org-deck--build-meta-info (info)
  413. "Return meta tags for exported document.
  414. INFO is a plist used as a communication channel."
  415. (let* ((title (org-export-data (plist-get info :title) info))
  416. (author (and (plist-get info :with-author)
  417. (let ((auth (plist-get info :author)))
  418. (and auth (org-export-data auth info)))))
  419. (date (and (plist-get info :with-date)
  420. (let ((date (plist-get info :date)))
  421. (and date (org-export-data date info)))))
  422. (description (plist-get info :description))
  423. (keywords (plist-get info :keywords)))
  424. (mapconcat
  425. 'identity
  426. (list
  427. (format "<title>%s</title>" title)
  428. (format "<meta http-equiv='Content-Type' content='text/html; charset=%s'/>"
  429. (or (and org-html-coding-system
  430. (fboundp 'coding-system-get)
  431. (coding-system-get
  432. org-html-coding-system 'mime-charset))
  433. "iso-8859-1"))
  434. (mapconcat
  435. (lambda (attr)
  436. (when (< 0 (length (car attr)))
  437. (format "<meta name='%s' content='%s'/>\n"
  438. (nth 1 attr) (car attr))))
  439. (list '("Org-mode" "generator")
  440. `(,author "author")
  441. `(,description "description")
  442. `(,keywords "keywords")) "")) "\n")))
  443. (defun org-deck-export-as-html
  444. (&optional async subtreep visible-only body-only ext-plist)
  445. "Export current buffer to an HTML buffer.
  446. If narrowing is active in the current buffer, only export its
  447. narrowed part.
  448. If a region is active, export that region.
  449. A non-nil optional argument ASYNC means the process should happen
  450. asynchronously. The resulting buffer should be accessible
  451. through the `org-export-stack' interface.
  452. When optional argument SUBTREEP is non-nil, export the sub-tree
  453. at point, extracting information from the headline properties
  454. first.
  455. When optional argument VISIBLE-ONLY is non-nil, don't export
  456. contents of hidden elements.
  457. When optional argument BODY-ONLY is non-nil, only write code
  458. between \"<body>\" and \"</body>\" tags.
  459. EXT-PLIST, when provided, is a property list with external
  460. parameters overriding Org default settings, but still inferior to
  461. file-local settings.
  462. Export is done in a buffer named \"*Org deck.js Export*\", which
  463. will be displayed when `org-export-show-temporary-export-buffer'
  464. is non-nil."
  465. (interactive)
  466. (if async
  467. (org-export-async-start
  468. (lambda (output)
  469. (with-current-buffer (get-buffer-create "*Org deck.js Export*")
  470. (erase-buffer)
  471. (insert output)
  472. (goto-char (point-min))
  473. (nxml-mode)
  474. (org-export-add-to-stack (current-buffer) 'deck)))
  475. `(org-export-as 'deck ,subtreep ,visible-only ,body-only ',ext-plist))
  476. (let ((outbuf (org-export-to-buffer
  477. 'deck "*Org deck.js Export*"
  478. subtreep visible-only body-only ext-plist)))
  479. ;; Set major mode.
  480. (with-current-buffer outbuf (nxml-mode))
  481. (when org-export-show-temporary-export-buffer
  482. (switch-to-buffer-other-window outbuf)))))
  483. (defun org-deck-export-to-html
  484. (&optional async subtreep visible-only body-only ext-plist)
  485. "Export current buffer to a deck.js HTML file.
  486. If narrowing is active in the current buffer, only export its
  487. narrowed part.
  488. If a region is active, export that region.
  489. A non-nil optional argument ASYNC means the process should happen
  490. asynchronously. The resulting file should be accessible through
  491. the `org-export-stack' interface.
  492. When optional argument SUBTREEP is non-nil, export the sub-tree
  493. at point, extracting information from the headline properties
  494. first.
  495. When optional argument VISIBLE-ONLY is non-nil, don't export
  496. contents of hidden elements.
  497. When optional argument BODY-ONLY is non-nil, only write code
  498. between \"<body>\" and \"</body>\" tags.
  499. EXT-PLIST, when provided, is a property list with external
  500. parameters overriding Org default settings, but still inferior to
  501. file-local settings.
  502. Return output file's name."
  503. (interactive)
  504. (let* ((extension (concat "." org-html-extension))
  505. (file (org-export-output-file-name extension subtreep))
  506. (org-export-coding-system org-html-coding-system))
  507. (if async
  508. (org-export-async-start
  509. (lambda (f) (org-export-add-to-stack f 'deck))
  510. (let ((org-export-coding-system org-html-coding-system))
  511. `(expand-file-name
  512. (org-export-to-file
  513. 'deck ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
  514. (let ((org-export-coding-system org-html-coding-system))
  515. (org-export-to-file
  516. 'deck file subtreep visible-only body-only ext-plist)))))
  517. (defun org-deck-publish-to-html (plist filename pub-dir)
  518. "Publish an org file to deck.js HTML Presentation.
  519. FILENAME is the filename of the Org file to be published. PLIST
  520. is the property list for the given project. PUB-DIR is the
  521. publishing directory. Returns output file name."
  522. (org-publish-org-to 'deck filename ".html" plist pub-dir))
  523. (provide 'ox-deck)
  524. ;;; ox-deck.el ends here