slide timing: per-speaker timing comments activate speaker view pacing
Port the Google-Docs slide workflow convention: timing comments like
<!-- JD 00:30 --> (speaker code plus MM:SS/HH:MM:SS/seconds duration, or
just <!-- 00:30 --> for single-speaker talks) are converted into
data-timing attributes on the rendered slides' <section> elements, and
the calculated grand total is passed to reveal.js as the totalTime
config value, activating the pacing timer in the speaker view. A
document-supplied totalTime or defaultTiming takes precedence.
A per-speaker time summary is printed during rendering; the new
slide_timing() function computes slide, speaker, and grand totals
directly from an .Rmd source file without rendering it.
Change-Id: I89d37baab06c6ee8be7ab777a70b9b21295c8780
diff --git a/man/revealjs_presentation.Rd b/man/revealjs_presentation.Rd
index c1c1ff2..ba10ef0 100644
--- a/man/revealjs_presentation.Rd
+++ b/man/revealjs_presentation.Rd
@@ -178,6 +178,46 @@
to create notes only viewable in presentation mode.
}
+}
+
+\subsection{Slide timing}{
+
+Speaker time can be planned per slide and per speaker by adding a comment
+with a speaker code and the expected duration (in \code{MM:SS}, \code{HH:MM:SS}, or
+plain seconds format) anywhere inside a slide:
+
+\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## My slide title
+
+Some content
+
+<!-- MK 00:30 -->
+}\if{html}{\out{</div>}}
+
+This means Marc Kupietz will need 30 seconds for that slide. For talks
+presented by a single speaker, the speaker code can be omitted:
+\verb{<!-- 00:30 -->}.
+
+Typically you start from a known total time budget and adjust the
+individual slides to it. You can set this budget yourself with the
+reveal.js \code{totalTime} option (in seconds):
+
+\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output:
+ revealjs.ids::revealjs_presentation:
+ reveal_options:
+ totalTime: 3600 # one hour
+}\if{html}{\out{</div>}}
+
+During rendering, comments are converted into \code{data-timing} attributes on
+the slides' \verb{<section>} elements (several speakers per slide are summed
+up), and the calculated grand total is passed to reveal.js as the
+\code{totalTime} config value. This activates the pacing timer in the
+\href{https://revealjs.com/speaker-view/}{speaker view}, which shows how you
+are doing relative to your plan. A summary of the total time per speaker
+is printed during rendering. If the document sets \code{totalTime} or
+\code{defaultTiming} itself (via \code{reveal_options}), those take precedence.
+
+The function \code{\link[=slide_timing]{slide_timing()}} computes these totals directly from an
+\code{.Rmd} source file without rendering it.
\subsection{Search}{
When opt-in, it is possible to show a search box when pressing \code{CTRL + SHIFT + F}. It will seach in the whole presentation, and highlight matched words. The
diff --git a/man/slide_timing.Rd b/man/slide_timing.Rd
new file mode 100644
index 0000000..96cdcbf
--- /dev/null
+++ b/man/slide_timing.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/slide_timing.R
+\name{slide_timing}
+\alias{slide_timing}
+\title{Compute per-speaker slide times from timing comments}
+\usage{
+slide_timing(input, slide_level = 2)
+}
+\arguments{
+\item{input}{Path to an R Markdown file.}
+
+\item{slide_level}{Level of heading that denotes individual slides (should
+match the \code{slide_level} used when rendering).}
+}
+\value{
+A list with three elements: \code{slides} (one row per slide and
+speaker), \code{speakers} (total time per speaker), and \code{total} (grand total
+in seconds). \code{slide_timing()} is called for its side effect of printing a
+summary.
+}
+\description{
+Parses an R Markdown presentation for timing comments of the form
+\verb{<!-- MK 00:30 -->} (speaker code followed by a duration in \code{MM:SS},
+\code{HH:MM:SS}, or plain seconds format) or, for single-speaker talks, simply
+\verb{<!-- 00:30 -->}, and computes the time allocated to each slide, each
+speaker, and the whole presentation.
+}
+\details{
+The same convention can be used directly in
+\code{\link[=revealjs_presentation]{revealjs_presentation()}}: any such comment in the source document is
+automatically converted into a \code{data-timing} attribute on the enclosing
+slide's \verb{<section>} element, which activates the pacing timer in the
+reveal.js speaker view.
+}
+\examples{
+\dontrun{
+slide_timing("talk.Rmd")
+}
+
+}