ox-deck.el 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  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. (:html-postamble nil "html-postamble" nil t)
  45. (:html-preamble nil "html-preamble" nil t)
  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. (defcustom org-deck-postamble-template
  146. "<h1>%author - %title</h1>"
  147. "Format template to specify the postamble section of document.
  148. Completed using `org-fill-template', optional keys include
  149. %author, %email, %file, %title and %date.
  150. This is included in the document at the bottom of the content
  151. section, and uses the postamble element and id from
  152. `org-html-divs'. The default places the author and presentation
  153. title at the bottom of each slide. See also
  154. `org-deck-preamble-postamble-styles'."
  155. :group 'org-export-deck
  156. :type 'string)
  157. (defcustom org-deck-preamble-template ""
  158. "Format template to specify the preamble section of the document.
  159. Completed using `org-fill-template', optional keys include
  160. %author, %email, %file, %title and %date.
  161. This is included before the content section of the document and
  162. would normally be a header for the presentation. See also
  163. `org-deck-preamble-postamble-styles'."
  164. :group 'org-export-deck
  165. :type 'string)
  166. (defvar org-deck-preamble-postamble-styles
  167. `((both "left: 5px; width: 100%;")
  168. (preamble "position: absolute; top: 10px;")
  169. (postamble ""))
  170. "Alist of css styles for the preamble, postamble and both respectively.
  171. Can be overriden in `org-deck-styles'. See also `org-html-divs'.")
  172. (defvar org-deck-toc-styles
  173. (mapconcat
  174. 'identity
  175. (list
  176. "#table-of-contents a {color: inherit;}"
  177. "#table-of-contents ul {margin-bottom: 0;}"
  178. "#table-of-contents li {padding: 0;}") "\n")
  179. "Default css styles used for formatting a table of contents slide.
  180. Can be overriden in `org-deck-styles'.
  181. Note that when the headline numbering option is true, a \"list-style: none\"
  182. is automatically added to avoid both numbers and bullets on the toc entries.")
  183. (defcustom org-deck-styles
  184. "
  185. #title-slide h1 {
  186. position: static; padding: 0;
  187. margin-top: 10%;
  188. -webkit-transform: none;
  189. -moz-transform: none;
  190. -ms-transform: none;
  191. -o-transform: none;
  192. transform: none;
  193. }
  194. #title-slide h2 {
  195. text-align: center;
  196. border:none;
  197. padding: 0;
  198. margin: 0;
  199. }"
  200. "Deck specific CSS styles to include in exported html.
  201. Defaults to styles for the title page."
  202. :group 'org-export-deck
  203. :type 'string)
  204. (defcustom org-deck-title-slide-template
  205. "<h1>%title</h1>
  206. <h2>%author</h2>
  207. <h2>%email</h2>
  208. <h2>%date</h2>"
  209. "Format template to specify title page section.
  210. Completed using `org-fill-template', optional keys include
  211. %author, %email, %file, %title and %date.
  212. It will be wrapped in the element defined in the :html-container
  213. property, and defaults to the value of `org-html-container-element',
  214. and have the id \"title-slide\"."
  215. :group 'org-export-deck
  216. :type 'string)
  217. (defun org-deck-toc (depth info)
  218. (concat
  219. (format "<%s id='table-of-contents' class='slide'>\n"
  220. (plist-get info :html-container))
  221. (format "<h2>%s</h2>\n" (org-html--translate "Table of Contents" info))
  222. (org-html--toc-text
  223. (mapcar
  224. (lambda (headline)
  225. (let* ((class (org-element-property :HTML_CONTAINER_CLASS headline))
  226. (section-number
  227. (when
  228. (and (not (org-export-low-level-p headline info))
  229. (org-export-numbered-headline-p headline info))
  230. (concat
  231. (mapconcat
  232. 'number-to-string
  233. (org-export-get-headline-number headline info) ".") ". ")))
  234. (title
  235. (concat
  236. section-number
  237. (replace-regexp-in-string ; remove any links in headline...
  238. "</?a[^>]*>" ""
  239. (org-export-data
  240. (org-element-property :title headline) info)))))
  241. (cons
  242. (if (and class (string-match-p "\\<slide\\>" class))
  243. (format
  244. "<a href='#outline-container-%s'>%s</a>"
  245. (or (org-element-property :CUSTOM_ID headline)
  246. (mapconcat
  247. 'number-to-string
  248. (org-export-get-headline-number headline info) "-"))
  249. title)
  250. title)
  251. (org-export-get-relative-level headline info))))
  252. (org-export-collect-headlines info depth)))
  253. (format "</%s>\n" (plist-get info :html-container))))
  254. (defun org-deck--get-packages (info)
  255. (let ((prefix (concat (plist-get info :deck-base-url) "/"))
  256. (theme (plist-get info :deck-theme))
  257. (transition (plist-get info :deck-transition))
  258. (include (plist-get info :deck-include-extensions))
  259. (exclude (plist-get info :deck-exclude-extensions))
  260. (scripts '()) (sheets '()) (snippets '()))
  261. (add-to-list 'scripts (concat prefix "jquery-1.7.2.min.js"))
  262. (add-to-list 'scripts (concat prefix "core/deck.core.js"))
  263. (add-to-list 'scripts (concat prefix "modernizr.custom.js"))
  264. (add-to-list 'sheets (concat prefix "core/deck.core.css"))
  265. (mapc
  266. (lambda (extdir)
  267. (let* ((name (file-name-nondirectory extdir))
  268. (dir (file-name-as-directory extdir))
  269. (path (concat prefix "extensions/" name "/"))
  270. (base (format "deck.%s." name)))
  271. (when (and (or (eq nil include) (member name include))
  272. (not (member name exclude)))
  273. (when (file-exists-p (concat dir base "js"))
  274. (add-to-list 'scripts (concat path base "js")))
  275. (when (file-exists-p (concat dir base "css"))
  276. (add-to-list 'sheets (concat path base "css")))
  277. (when (file-exists-p (concat dir base "html"))
  278. (add-to-list 'snippets (concat dir base "html"))))))
  279. (org-deck--find-extensions))
  280. (if (not (string-match-p "^[[:space:]]*$" theme))
  281. (add-to-list 'sheets
  282. (if (file-name-directory theme) theme
  283. (format "%sthemes/style/%s" prefix theme))))
  284. (if (not (string-match-p "^[[:space:]]*$" transition))
  285. (add-to-list
  286. 'sheets
  287. (if (file-name-directory transition) transition
  288. (format "%sthemes/transition/%s" prefix transition))))
  289. (list :scripts (nreverse scripts) :sheets (nreverse sheets)
  290. :snippets snippets)))
  291. (defun org-deck-inner-template (contents info)
  292. "Return body of document string after HTML conversion.
  293. CONTENTS is the transcoded contents string. INFO is a plist
  294. holding export options."
  295. (concat contents "\n"))
  296. (defun org-deck-headline (headline contents info)
  297. (let ((org-html-toplevel-hlevel 2)
  298. (class (or (org-element-property :HTML_CONTAINER_CLASS headline) ""))
  299. (level (org-export-get-relative-level headline info)))
  300. (when (and (= 1 level) (not (string-match-p "\\<slide\\>" class)))
  301. (org-element-put-property headline :HTML_CONTAINER_CLASS (concat class " slide")))
  302. (org-html-headline headline contents info)))
  303. (defun org-deck-item (item contents info)
  304. "Transcode an ITEM element from Org to HTML.
  305. CONTENTS holds the contents of the item. INFO is a plist holding
  306. contextual information.
  307. If the containing headline has the property :slide, then
  308. the \"slide\" class will be added to the to the list element,
  309. which will make the list into a \"build\"."
  310. (let ((text (org-html-item item contents info)))
  311. (if (org-export-get-node-property :STEP item t)
  312. (replace-regexp-in-string "^<li>" "<li class='slide'>" text)
  313. text)))
  314. (defun org-deck-template-alist (info)
  315. (list
  316. `("title" . ,(car (plist-get info :title)))
  317. `("author" . ,(car (plist-get info :author)))
  318. `("email" . ,(plist-get info :email))
  319. `("date" . ,(nth 0 (plist-get info :date)))
  320. `("file" . ,(plist-get info :input-file))))
  321. (defun org-deck-template (contents info)
  322. "Return complete document string after HTML conversion.
  323. CONTENTS is the transcoded contents string. INFO is a plist
  324. holding export options."
  325. (let ((pkg-info (org-deck--get-packages info)))
  326. (mapconcat
  327. 'identity
  328. (list
  329. (plist-get info :html-doctype)
  330. (let ((lang (plist-get info :language)))
  331. (mapconcat
  332. (lambda (x)
  333. (apply
  334. 'format
  335. "<!--%s <html %s lang='%s' xmlns='http://www.w3.org/1999/xhtml'> %s<![endif]-->"
  336. x))
  337. (list `("[if lt IE 7]>" "class='no-js ie6'" ,lang "")
  338. `("[if IE 7]>" "class='no-js ie7'" ,lang "")
  339. `("[if IE 8]>" "class='no-js ie8'" ,lang "")
  340. `("[if gt IE 8]><!-->" "" ,lang "<!--")) "\n"))
  341. "<head>"
  342. (org-deck--build-meta-info info)
  343. (mapconcat
  344. (lambda (sheet)
  345. (format
  346. "<link rel='stylesheet' href='%s' type='text/css' />" sheet))
  347. (plist-get pkg-info :sheets) "\n")
  348. (mapconcat
  349. (lambda (script)
  350. (format
  351. "<script src='%s' type='text/javascript'></script>" script))
  352. (plist-get pkg-info :scripts) "\n")
  353. (org-html--build-mathjax-config info)
  354. "<script type='text/javascript'>"
  355. " $(document).ready(function () { $.deck('.slide'); });"
  356. "</script>"
  357. (org-html--build-head info)
  358. "<style type='text/css'>"
  359. org-deck-toc-styles
  360. (when (plist-get info :section-numbers)
  361. "#table-of-contents ul li {list-style-type: none;}")
  362. (format "#%s, #%s {%s}"
  363. (nth 2 (assq 'preamble org-html-divs))
  364. (nth 2 (assq 'postamble org-html-divs))
  365. (nth 1 (assq 'both org-deck-preamble-postamble-styles)))
  366. (format "#%s {%s}"
  367. (nth 2 (assq 'preamble org-html-divs))
  368. (nth 1 (assq 'preamble org-deck-preamble-postamble-styles)))
  369. (format "#%s {%s}"
  370. (nth 2 (assq 'postamble org-html-divs))
  371. (nth 1 (assq 'postamble org-deck-preamble-postamble-styles)))
  372. org-deck-styles
  373. "</style>"
  374. "</head>"
  375. "<body>"
  376. (format "<%s id='%s' class='deck-status'>"
  377. (nth 1 (assq 'preamble org-html-divs))
  378. (nth 2 (assq 'preamble org-html-divs)))
  379. (org-fill-template
  380. org-deck-preamble-template (org-deck-template-alist info))
  381. (format "</%s>" (nth 1 (assq 'preamble org-html-divs)))
  382. (format "<%s id='%s' class='deck-container'>"
  383. (nth 1 (assq 'content org-html-divs))
  384. (nth 2 (assq 'content org-html-divs)))
  385. ;; title page
  386. (format "<%s id='title-slide' class='slide'>"
  387. (plist-get info :html-container))
  388. (org-fill-template
  389. org-deck-title-slide-template (org-deck-template-alist info))
  390. (format "</%s>" (plist-get info :html-container))
  391. ;; toc page
  392. (let ((depth (plist-get info :with-toc)))
  393. (when depth (org-deck-toc depth info)))
  394. contents
  395. (mapconcat
  396. (lambda (snippet)
  397. (with-temp-buffer (insert-file-contents snippet)
  398. (buffer-string)))
  399. (plist-get pkg-info :snippets) "\n")
  400. (format "<%s id='%s' class='deck-status'>"
  401. (nth 1 (assq 'postamble org-html-divs))
  402. (nth 2 (assq 'postamble org-html-divs)))
  403. (org-fill-template
  404. org-deck-postamble-template (org-deck-template-alist info))
  405. (format "</%s>" (nth 1 (assq 'postamble org-html-divs)))
  406. (format "</%s>" (nth 1 (assq 'content org-html-divs)))
  407. "</body>"
  408. "</html>\n") "\n")))
  409. (defun org-deck--build-meta-info (info)
  410. "Return meta tags for exported document.
  411. INFO is a plist used as a communication channel."
  412. (let* ((title (org-export-data (plist-get info :title) info))
  413. (author (and (plist-get info :with-author)
  414. (let ((auth (plist-get info :author)))
  415. (and auth (org-export-data auth info)))))
  416. (date (and (plist-get info :with-date)
  417. (let ((date (plist-get info :date)))
  418. (and date (org-export-data date info)))))
  419. (description (plist-get info :description))
  420. (keywords (plist-get info :keywords)))
  421. (mapconcat
  422. 'identity
  423. (list
  424. (format "<title>%s</title>" title)
  425. (format "<meta http-equiv='Content-Type' content='text/html; charset=%s'/>"
  426. (or (and org-html-coding-system
  427. (fboundp 'coding-system-get)
  428. (coding-system-get
  429. org-html-coding-system 'mime-charset))
  430. "iso-8859-1"))
  431. (mapconcat
  432. (lambda (attr)
  433. (when (< 0 (length (car attr)))
  434. (format "<meta name='%s' content='%s'/>\n"
  435. (nth 1 attr) (car attr))))
  436. (list '("Org-mode" "generator")
  437. `(,author "author")
  438. `(,description "description")
  439. `(,keywords "keywords")) "")) "\n")))
  440. (defun org-deck-export-as-html
  441. (&optional async subtreep visible-only body-only ext-plist)
  442. "Export current buffer to an HTML buffer.
  443. If narrowing is active in the current buffer, only export its
  444. narrowed part.
  445. If a region is active, export that region.
  446. A non-nil optional argument ASYNC means the process should happen
  447. asynchronously. The resulting buffer should be accessible
  448. through the `org-export-stack' interface.
  449. When optional argument SUBTREEP is non-nil, export the sub-tree
  450. at point, extracting information from the headline properties
  451. first.
  452. When optional argument VISIBLE-ONLY is non-nil, don't export
  453. contents of hidden elements.
  454. When optional argument BODY-ONLY is non-nil, only write code
  455. between \"<body>\" and \"</body>\" tags.
  456. EXT-PLIST, when provided, is a property list with external
  457. parameters overriding Org default settings, but still inferior to
  458. file-local settings.
  459. Export is done in a buffer named \"*Org deck.js Export*\", which
  460. will be displayed when `org-export-show-temporary-export-buffer'
  461. is non-nil."
  462. (interactive)
  463. (if async
  464. (org-export-async-start
  465. (lambda (output)
  466. (with-current-buffer (get-buffer-create "*Org deck.js Export*")
  467. (erase-buffer)
  468. (insert output)
  469. (goto-char (point-min))
  470. (nxml-mode)
  471. (org-export-add-to-stack (current-buffer) 'deck)))
  472. `(org-export-as 'deck ,subtreep ,visible-only ,body-only ',ext-plist))
  473. (let ((outbuf (org-export-to-buffer
  474. 'deck "*Org deck.js Export*"
  475. subtreep visible-only body-only ext-plist)))
  476. ;; Set major mode.
  477. (with-current-buffer outbuf (nxml-mode))
  478. (when org-export-show-temporary-export-buffer
  479. (switch-to-buffer-other-window outbuf)))))
  480. (defun org-deck-export-to-html
  481. (&optional async subtreep visible-only body-only ext-plist)
  482. "Export current buffer to a deck.js HTML file.
  483. If narrowing is active in the current buffer, only export its
  484. narrowed part.
  485. If a region is active, export that region.
  486. A non-nil optional argument ASYNC means the process should happen
  487. asynchronously. The resulting file should be accessible through
  488. the `org-export-stack' interface.
  489. When optional argument SUBTREEP is non-nil, export the sub-tree
  490. at point, extracting information from the headline properties
  491. first.
  492. When optional argument VISIBLE-ONLY is non-nil, don't export
  493. contents of hidden elements.
  494. When optional argument BODY-ONLY is non-nil, only write code
  495. between \"<body>\" and \"</body>\" tags.
  496. EXT-PLIST, when provided, is a property list with external
  497. parameters overriding Org default settings, but still inferior to
  498. file-local settings.
  499. Return output file's name."
  500. (interactive)
  501. (let* ((extension (concat "." org-html-extension))
  502. (file (org-export-output-file-name extension subtreep))
  503. (org-export-coding-system org-html-coding-system))
  504. (if async
  505. (org-export-async-start
  506. (lambda (f) (org-export-add-to-stack f 'deck))
  507. (let ((org-export-coding-system org-html-coding-system))
  508. `(expand-file-name
  509. (org-export-to-file
  510. 'deck ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
  511. (let ((org-export-coding-system org-html-coding-system))
  512. (org-export-to-file
  513. 'deck file subtreep visible-only body-only ext-plist)))))
  514. (defun org-deck-publish-to-html (plist filename pub-dir)
  515. "Publish an org file to deck.js HTML Presentation.
  516. FILENAME is the filename of the Org file to be published. PLIST
  517. is the property list for the given project. PUB-DIR is the
  518. publishing directory. Returns output file name."
  519. (org-publish-org-to 'deck filename ".html" plist pub-dir))
  520. (provide 'ox-deck)
  521. ;;; ox-deck.el ends here