diff --git a/Readme.org b/Readme.org index 7df9a0a..a09182c 100644 --- a/Readme.org +++ b/Readme.org @@ -144,6 +144,19 @@ $ git clone https://github.com/yjwen/org-reveal.git ,#+REVEAL_HLEVEL 2 #+END_SRC +** Force Split + + If one headings has too many things to fit into one slide, you can + split the contents into multiple vertical slides manually, by inserting + +#+BEGIN_SRC org + #+REVEAL: split +#+END_SRC + +#+REVEAL: split + + Now a new slide begin after =#+REVEAL= keyword. + ** Select Theme and Transition Themes and transition styles are set globally throughout the whole diff --git a/ox-reveal.el b/ox-reveal.el index f3bf5da..164ff13 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -55,8 +55,13 @@ '((headline . org-reveal-headline) (inner-template . org-reveal-inner-template) (item . org-reveal-item) + (keyword . org-reveal-keyword) (paragraph . org-reveal-paragraph) - (template . org-reveal-template))) + (section . org-reveal-section) + (template . org-reveal-template)) + + :export-block "REVEAL" + ) (defcustom org-reveal-root "./reveal.js" "The root directory of reveal.js packages. It is the directory @@ -134,8 +139,16 @@ can be include." (defun if-format (fmt val) (if val (format fmt val) "")) +(defun org-reveal-export-block (export-block contents info) + "Transcode an EXPORT-BLOCK element from Org to Reveal. +CONTENTS is nil. INFO is a plist holding contextual information." + (format "export-block\ntype: %s, value: %s, contents: %s" + (org-element-property :type export-block) + (org-element-property :value export-block) + contents)) + (defun org-reveal-headline (headline contents info) - "Transcode a HEADLINE element from Org to HTML. + "Transcode a HEADLINE element from Org to Reveal. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." ;; First call org-html-headline to get the formatted HTML contents. @@ -218,7 +231,7 @@ holding contextual information." ;; one to get the correct
") (descriptive ""))))) -(defun org-reveal--headline-property (property blob) - "Get property from BLOB's parent headline and return." - (let ((headline (if (eq (org-element-type blob) 'headline) blob - (org-export-get-parent-headline blob)))) - (org-element-property property headline))) - - (defun org-reveal--get-frag (info) "Get Reveal fragment settings from context." (let ((frag (plist-get info :reveal-frag))) @@ -399,6 +405,32 @@ contextual information." (org-reveal-format-list-item contents type checkbox (or tag counter) frag))) +(defun org-reveal-parse-token (key &optional value) + "Return HTML tags or perform SIDE EFFECT according to key" + (case (intern key) + (split "\n
") + (t (format "key: %s, value: %s" key value)))) + +(defun org-reveal-parse-keyword-value (value) + "According to the value content, return HTML tags to split slides." + (let ((tokens (mapcar + (lambda (x) (split-string x ":")) + (split-string value)))) + (mapconcat + (lambda (x) (apply 'org-reveal-parse-token x)) + tokens + ""))) + + +(defun org-reveal-keyword (keyword contents info) + "Transcode a KEYWORD element from Org to HTML, +and may change custom variables as SIDE EFFECT. +CONTENTS is nil. INFO is a plist holding contextual information." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + (when (string= key "REVEAL") + (org-reveal-parse-keyword-value value)))) + (defun org-reveal-paragraph (paragraph contents info) "Transcode a PARAGRAPH element from Org to Reveal HTML. CONTENTS is the contents of the paragraph, as a string. INFO is @@ -418,6 +450,12 @@ the plist used as a communication channel." (org-export-read-attribute :attr_reveal paragraph :frag)) contents))))) +(defun org-reveal-section (section contents info) + "Transcode a SECTION element from Org to HTML. +CONTENTS holds the contents of the section. INFO is a plist +holding contextual information." + ;; Just return the contents. No "
" tags. + contents) (defun org-reveal-template (contents info) "Return complete document string after HTML conversion.