ox-deck.el 22 KB

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