Export only corrent sub-tree.

This commit is contained in:
Yujie Wen 2015-09-28 16:53:50 +08:00
parent 238523734f
commit 4f3cffd106
2 changed files with 27 additions and 7 deletions

View File

@ -612,6 +612,12 @@ fibs = 0 : 1 : next fibs
Code highlight by highlight.js is also disabled. But *code
highlight by Emacs is not effected.*
** Export Current Subtree
Use menu entry " C-c C-e R S" to export only current subtree,
without the title slide and the table of content, for a quick preview
of your current edition.
* Tips
** Disable Heading Numbers

View File

@ -39,7 +39,8 @@
:menu-entry
'(?R "Export to reveal.js HTML Presentation"
((?R "To file" org-reveal-export-to-html)
(?B "To file and Browse" org-reveal-export-to-html-and-browse)))
(?B "To file and browse" org-reveal-export-to-html-and-browse)
(?S "Current subtree to file" org-reveal-export-current-subtree)))
:options-alist
'((:reveal-control nil "reveal_control" org-reveal-control t)
@ -660,9 +661,10 @@ dependencies: [
(defun org-reveal-toc (depth info)
"Build a slide of table of contents."
(format "<section id=\"table-of-contents\">\n%s</section>\n"
(replace-regexp-in-string "<a href=\"#" "<a href=\"#/slide-"
(org-html-toc depth info))))
(let ((toc (org-html-toc depth info)))
(if toc
(format "<section id=\"table-of-contents\">\n%s</section>\n"
(replace-regexp-in-string "<a href=\"#" "<a href=\"#/slide-" toc)))))
(defun org-reveal-inner-template (contents info)
"Return body of document string after HTML conversion.
@ -671,7 +673,9 @@ holding export options."
(concat
;; Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth (org-reveal-toc depth info)))
(when (and depth
(not (plist-get info :reveal-subtree)))
(org-reveal-toc depth info)))
;; Document contents.
contents))
@ -923,9 +927,10 @@ info is a plist holding export options."
"</head>
<body>\n"
(org-reveal--build-pre/postamble 'preamble info)
"<div class=\"reveal\">
"<div class=\"reveal\">
<div class=\"slides\">\n"
(if (plist-get info :reveal-title-slide)
(if (and (plist-get info :reveal-title-slide)
(not (plist-get info :reveal-subtree)))
(concat
(format "<section id=\"sec-title-slide\"%s%s%s%s>\n"
(if-format " data-background=\"%s\""
@ -1030,6 +1035,15 @@ transformed fragment attribute to ELEM's attr_html plist."
(interactive)
(browse-url-of-file (expand-file-name (org-reveal-export-to-html async subtreep visible-only body-only ext-plist))))
(defun org-reveal-export-current-subtree
(&optional async subtreep visible-only body-only ext-plist)
"Export current subtree to a Reveal.js HTML file."
(interactive)
(org-narrow-to-subtree)
(let ((ret (org-reveal-export-to-html async subtreep visible-only body-only (plist-put ext-plist :reveal-subtree t))))
(widen)
ret))
;;;###autoload
(defun org-reveal-publish-to-reveal
(plist filename pub-dir)