-
Notifications
You must be signed in to change notification settings - Fork 188
/
document.html.slim
247 lines (237 loc) · 14.6 KB
/
document.html.slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
doctype 5
html lang=(attr :lang, 'en' unless attr? :nolang)
head
meta charset="utf-8"
- if RUBY_ENGINE == 'opal' && JAVASCRIPT_PLATFORM == 'node'
- revealjsdir = (attr :revealjsdir, 'node_modules/reveal.js')
- else
- revealjsdir = (attr :revealjsdir, 'reveal.js')
- unless (asset_uri_scheme = (attr 'asset-uri-scheme', 'https')).empty?
- asset_uri_scheme = %(#{asset_uri_scheme}:)
- cdn_base = %(#{asset_uri_scheme}//cdnjs.cloudflare.com/ajax/libs)
- [:description, :keywords, :author, :copyright].each do |key|
- if attr? key
meta name=key content=(attr key)
- linkcss = (attr? 'linkcss')
title=(doctitle sanitize: true, use_fallback: true)
meta content="yes" name="apple-mobile-web-app-capable"
meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"
meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" name="viewport"
link href="#{revealjsdir}/css/reveal.css" rel="stylesheet"
/ Default theme required even when using custom theme
- if attr? :revealjs_customtheme
link rel='stylesheet' href=(attr :revealjs_customtheme) id='theme'
- else
link rel='stylesheet' href='#{revealjsdir}/css/theme/#{attr 'revealjs_theme', 'black'}.css' id='theme'
include asciidoctor_revealjs.css.slim
- if attr? :icons, 'font'
/ iconfont-remote is implicitly set by Asciidoctor core. See https://github.com/asciidoctor/asciidoctor.org/issues/361
- if attr? 'iconfont-remote'
link rel='stylesheet' href=(attr 'iconfont-cdn', %(#{cdn_base}/font-awesome/5.12.0-1/css/all.min.css))
link rel='stylesheet' href=(attr 'iconfont-cdn', %(#{cdn_base}/font-awesome/5.12.0-1/css/v4-shims.min.css))
- else
link rel='stylesheet' href=(normalize_web_path %(#{attr 'iconfont-name', 'font-awesome'}.css), (attr 'stylesdir', ''), false)
- if attr? :stem
- eqnums_val = (attr 'eqnums', 'none')
- eqnums_val = 'AMS' if eqnums_val == ''
- eqnums_opt = %( equationNumbers: { autoNumber: "#{eqnums_val}" } )
script type='text/x-mathjax-config'
| MathJax.Hub.Config({
tex2jax: {
inlineMath: [#{Asciidoctor::INLINE_MATH_DELIMITERS[:latexmath].to_s}],
displayMath: [#{Asciidoctor::BLOCK_MATH_DELIMITERS[:latexmath].to_s}],
ignoreClass: "nostem|nolatexmath"
},
asciimath2jax: {
delimiters: [#{Asciidoctor::BLOCK_MATH_DELIMITERS[:asciimath].to_s}],
ignoreClass: "nostem|noasciimath"
},
TeX: {#{eqnums_opt}}
});
script src='#{cdn_base}/mathjax/2.4.0/MathJax.js?config=TeX-MML-AM_HTMLorMML'
- syntax_hl = self.syntax_highlighter
- if syntax_hl && (syntax_hl.docinfo? :head)
=syntax_hl.docinfo :head, self, cdn_base_url: cdn_base, linkcss: linkcss, self_closing_tag_slash: '/'
/ If the query includes 'print-pdf', use the PDF print sheet
javascript:
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? "#{revealjsdir}/css/print/pdf.css" : "#{revealjsdir}/css/print/paper.css";
document.getElementsByTagName( 'head' )[0].appendChild( link );
/[if lt IE 9]
<script src="#{revealjsdir}/lib/js/html5shiv.js"></script>
- unless (docinfo_content = docinfo :header, '.html').empty?
=docinfo_content
- if attr? :customcss
link rel='stylesheet' href=((customcss = attr :customcss).empty? ? 'asciidoctor-revealjs.css' : customcss)
body
.reveal
/ Any section element inside of this container is displayed as a slide
.slides
- unless notitle || !has_header?
- bg_image = (attr? 'title-slide-background-image') ? (image_uri(attr 'title-slide-background-image')) : nil
- bg_video = (attr? 'title-slide-background-video') ? (media_uri(attr 'title-slide-background-video')) : nil
section.title(class = role
data-state='title'
data-transition=(attr 'title-slide-transition')
data-transition-speed=(attr 'title-slide-transition-speed')
data-background=(attr 'title-slide-background')
data-background-size=(attr 'title-slide-background-size')
data-background-image=bg_image
data-background-video=bg_video
data-background-video-loop=(attr 'title-slide-background-video-loop')
data-background-video-muted=(attr 'title-slide-background-video-muted')
data-background-opacity=(attr "background-opacity")
data-background-iframe=(attr 'title-slide-background-iframe')
data-background-color=(attr 'title-slide-background-color')
data-background-repeat=(attr 'title-slide-background-repeat')
data-background-position=(attr 'title-slide-background-position')
data-background-transition=(attr 'title-slide-background-transition'))
- if (_title_obj = doctitle partition: true, use_fallback: true).subtitle?
h1=slice_text _title_obj.title, (_slice = header.option? :slice)
h2=slice_text _title_obj.subtitle, _slice
- else
- preamble = @document.find_by context: :preamble
- unless preamble.nil? or preamble.length == 0
div.preamble=preamble.pop.content
- unless author.nil?
p.author: small=author
=content
script src="#{revealjsdir}/lib/js/head.min.js"
script src="#{revealjsdir}/js/reveal.js"
javascript:
Array.prototype.slice.call(document.querySelectorAll('.slides section')).forEach(function(slide) {
if (slide.getAttribute('data-background-color')) return;
// user needs to explicitly say he wants CSS color to override otherwise we might break custom css or theme (#226)
if (!(slide.classList.contains('canvas') || slide.classList.contains('background'))) return;
var bgColor = getComputedStyle(slide).backgroundColor;
if (bgColor !== 'rgba(0, 0, 0, 0)' && bgColor !== 'transparent') {
slide.setAttribute('data-background-color', bgColor);
slide.style.backgroundColor = 'transparent';
}
})
// See https://github.com/hakimel/reveal.js#configuration for a full list of configuration options
Reveal.initialize({
// Display presentation control arrows
controls: #{to_boolean(attr 'revealjs_controls', true)},
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: #{to_boolean(attr 'revealjs_controlstutorial', true)},
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: '#{attr 'revealjs_controlslayout', 'bottom-right'}',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: '#{attr 'revealjs_controlsbackarrows', 'faded'}',
// Display a presentation progress bar
progress: #{to_boolean(attr 'revealjs_progress', true)},
// Display the page number of the current slide
slideNumber: #{to_valid_slidenumber(attr 'revealjs_slidenumber', false)},
// Control which views the slide number displays on
showSlideNumber: '#{attr 'revealjs_showslidenumber', 'all'}',
// Push each slide change to the browser history
history: #{to_boolean(attr 'revealjs_history', false)},
// Enable keyboard shortcuts for navigation
keyboard: #{to_boolean(attr 'revealjs_keyboard', true)},
// Enable the slide overview mode
overview: #{to_boolean(attr 'revealjs_overview', true)},
// Vertical centering of slides
center: #{to_boolean(attr 'revealjs_center', true)},
// Enables touch navigation on devices with touch input
touch: #{to_boolean(attr 'revealjs_touch', true)},
// Loop the presentation
loop: #{to_boolean(attr 'revealjs_loop', false)},
// Change the presentation direction to be RTL
rtl: #{to_boolean(attr 'revealjs_rtl', false)},
// Randomizes the order of slides each time the presentation loads
shuffle: #{to_boolean(attr 'revealjs_shuffle', false)},
// Turns fragments on and off globally
fragments: #{to_boolean(attr 'revealjs_fragments', true)},
// Flags whether to include the current fragment in the URL,
// so that reloading brings you to the same fragment position
fragmentInURL: #{to_boolean(attr 'revealjs_fragmentinurl', false)},
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: #{to_boolean(attr 'revealjs_embedded', false)},
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: #{to_boolean(attr 'revealjs_help', true)},
// Flags if speaker notes should be visible to all viewers
showNotes: #{to_boolean(attr 'revealjs_shownotes', false)},
// Global override for autolaying embedded media (video/audio/iframe)
// - null: Media will only autoplay if data-autoplay is present
// - true: All media will autoplay, regardless of individual setting
// - false: No media will autoplay, regardless of individual setting
autoPlayMedia: #{attr 'revealjs_autoplaymedia', 'null'},
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: #{attr 'revealjs_autoslide', 0},
// Stop auto-sliding after user input
autoSlideStoppable: #{to_boolean(attr 'revealjs_autoslidestoppable', true)},
// Use this method for navigation when auto-sliding
autoSlideMethod: #{attr 'revealjs_autoslidemethod', 'Reveal.navigateNext'},
// Specify the average time in seconds that you think you will spend
// presenting each slide. This is used to show a pacing timer in the
// speaker view
defaultTiming: #{attr 'revealjs_defaulttiming', 120},
// Enable slide navigation via mouse wheel
mouseWheel: #{to_boolean(attr 'revealjs_mousewheel', false)},
// Hides the address bar on mobile devices
hideAddressBar: #{to_boolean(attr 'revealjs_hideaddressbar', true)},
// Opens links in an iframe preview overlay
// Add `data-preview-link` and `data-preview-link="false"` to customise each link
// individually
previewLinks: #{to_boolean(attr 'revealjs_previewlinks', false)},
// Transition style (e.g., none, fade, slide, convex, concave, zoom)
transition: '#{attr 'revealjs_transition', 'slide'}',
// Transition speed (e.g., default, fast, slow)
transitionSpeed: '#{attr 'revealjs_transitionspeed', 'default'}',
// Transition style for full page slide backgrounds (e.g., none, fade, slide, convex, concave, zoom)
backgroundTransition: '#{attr 'revealjs_backgroundtransition', 'fade'}',
// Number of slides away from the current that are visible
viewDistance: #{attr 'revealjs_viewdistance', 3},
// Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'")
parallaxBackgroundImage: '#{attr 'revealjs_parallaxbackgroundimage', ''}',
// Parallax background size in CSS syntax (e.g., "2100px 900px")
parallaxBackgroundSize: '#{attr 'revealjs_parallaxbackgroundsize', ''}',
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal: #{attr 'revealjs_parallaxbackgroundhorizontal', 'null'},
parallaxBackgroundVertical: #{attr 'revealjs_parallaxbackgroundvertical', 'null'},
// The display mode that will be used to show slides
display: '#{attr 'revealjs_display', 'block'}',
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: #{attr 'revealjs_width', 960},
height: #{attr 'revealjs_height', 700},
// Factor of the display size that should remain empty around the content
margin: #{attr 'revealjs_margin', 0.1},
// Bounds for smallest/largest possible scale to apply to content
minScale: #{attr 'revealjs_minscale', 0.2},
maxScale: #{attr 'revealjs_maxscale', 1.5},
// PDF Export Options
// Put each fragment on a separate page
pdfSeparateFragments: #{to_boolean(attr 'revealjs_pdfseparatefragments', true)},
// For slides that do not fit on a page, max number of pages
pdfMaxPagesPerSlide: #{attr 'revealjs_pdfmaxpagesperslide', 1},
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '#{revealjsdir}/lib/js/classList.js', condition: function() { return !document.body.classList; } },
#{(document.attr? 'source-highlighter', 'highlightjs') ? "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }," : nil}
#{(attr? 'revealjs_plugin_zoom', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/zoom-js/zoom.js', async: true }," }
#{(attr? 'revealjs_plugin_notes', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/notes/notes.js', async: true }," }
#{(attr? 'revealjs_plugin_marked', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }," : "" }
#{(attr? 'revealjs_plugin_markdown', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }," : "" }
#{(attr? 'revealjs_plugin_pdf', 'enabled') ? "{ src: '#{revealjsdir}/plugin/print-pdf/print-pdf.js', async: true }," : "" }
#{(attr? 'revealjs_plugins') ? File.read(attr('revealjs_plugins', '')) : ""}
],
#{(attr? 'revealjs_plugins_configuration') ? File.read(attr('revealjs_plugins_configuration', '')) : ""}
});
- if syntax_hl && (syntax_hl.docinfo? :footer)
=syntax_hl.docinfo :footer, self, cdn_base_url: cdn_base, linkcss: linkcss, self_closing_tag_slash: '/'
- unless (docinfo_content = (docinfo :footer, '.html')).empty?
=docinfo_content