Support custom slide size and scaling constraints.

This commit is contained in:
yjwen 2013-06-19 17:02:03 +08:00
parent e88a93528f
commit 785aa05c55
2 changed files with 73 additions and 2 deletions

View File

@ -2,7 +2,12 @@
#+Author: Yujie Wen
#+Email: yjwen.ty@gmail.com
#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil reveal_control:t reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil
#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil reveal_control:t
#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil
#+OPTIONS: reveal_width:1200 reveal_height:800
#+REVEAL_MARGIN: 0.1
#+REVEAL_MIN_SCALE: 0.5
#+REVEAL_MAX_SCALE: 2.5
#+REVEAL_TRANS: cube
#+REVEAL_THEME: moon
#+REVEAL_HLEVEL: 2
@ -156,7 +161,7 @@ $ git clone https://github.com/yjwen/org-reveal.git
,#+REVEAL: split
#+END_SRC
#+REVEAL: split:force-split
#+REVEAL: split
Now a new slide begins after =#+REVEAL= keyword.
@ -171,6 +176,20 @@ $ git clone https://github.com/yjwen/org-reveal.git
Available transitions are: default|cube|page|concave|zoom|linear|fade|none.
** Slide Size
Reveal.js scales slides to best fit the display resolution. But in case
the auto-sizes are not satisfiable, you can specify the desired size by
option tag =width= and =height=.
The scaling behavior can also be contrainted by setting following
options:
* =#+REVEAL_MARGIN:= :: a float number, the factor of empty area
surrounding slide contents.
* =#+REVEAL_MIN_SCALE:= :: a float number, the minimun scaling down
ratio.
* =#+REVEAL_MAX_SCALE:= :: a float number, the maximum scaling up
ratio.
** Extra Stylesheets
Set =REVEAL_EXTRA_CSS= to a stylesheet file path in order to load extra custom

View File

@ -46,6 +46,11 @@
(:reveal-rolling-links nil "reveal_rolling_links" org-reveal-rolling-links t)
(:reveal-keyboard nil "reveal_keyboard" org-reveal-keyboard t)
(:reveal-overview nil "reveal_overview" org-reveal-overview t)
(:reveal-width nil "reveal_width" org-reveal-width t)
(:reveal-height nil "reveal_height" org-reveal-height)
(:reveal-margin"REVEAL_MARGIN" nil org-reveal-margin t)
(:reveal-min-scale "REVEAL_MIN_SCALE" nil org-reveal-min-scale t)
(:reveal-max-scale "REVEAL_MAX_SCALE" nil org-reveal-max-scale t)
(:reveal-root "REVEAL_ROOT" nil org-reveal-root t)
(:reveal-trans "REVEAL_TRANS" nil org-reveal-transition t)
(:reveal-speed "REVEAL_SPEED" nil org-reveal-transition-speed t)
@ -154,6 +159,31 @@ can be include."
:group 'org-export-reveal
:type 'boolean)
(defcustom org-reveal-width -1
"Slide width"
:group 'org-export-reveal
:type 'integer)
(defcustom org-reveal-height -1
"Slide height"
:group 'org-export-reveal
:type 'integer)
(defcustom org-reveal-margin -1
"Slide margin"
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-min-scale -1
"Minimum bound for scaling slide."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-max-scale -1
"Maximum bound for scaling slide."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-mathjax nil
"Enable MathJax script."
:group 'org-export-reveal
@ -342,6 +372,12 @@ custom variable `org-reveal-root'."
rollingLinks: %s,
keyboard: %s,
overview: %s,
%s // slide width
%s // slide height
%s // slide margin
%s // slide minimum scaling factor
%s // slide maximum scaling factor
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || '%s', // default/cube/page/concave/zoom/linear/fade/none
@ -353,6 +389,22 @@ custom variable `org-reveal-root'."
(if (plist-get info :reveal-rolling-links) "true" "false")
(if (plist-get info :reveal-keyboard) "true" "false")
(if (plist-get info :reveal-overview) "true" "false")
(let ((width (plist-get info :reveal-width)))
(if (> width 0) (format "width: %d," width)
""))
(let ((height (plist-get info :reveal-height)))
(if (> height 0) (format "height: %d," height)
""))
(let ((margin (string-to-number (plist-get info :reveal-margin))))
(if (>= margin 0) (format "margin: %.2f," margin)
""))
(let ((min-scale (string-to-number (plist-get info :reveal-min-scale))))
(if (> min-scale 0) (format "minScale: %.2f," min-scale)
""))
(let ((max-scale (string-to-number (plist-get info :reveal-max-scale))))
(if (> max-scale 0) (format "maxScale: %.2f," max-scale)
""))
(plist-get info :reveal-trans)
(plist-get info :reveal-speed))
(format "