asciidoctor-revealjs 3.1.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +86 -0
  3. data/HACKING.adoc +18 -11
  4. data/README.adoc +260 -27
  5. data/Rakefile +12 -4
  6. data/asciidoctor-revealjs.gemspec +4 -2
  7. data/examples/docinfo-footer-revealjs.html +10 -0
  8. data/examples/docinfo-revealjs.html +7 -0
  9. data/examples/font-awesome.adoc +2 -1
  10. data/examples/font-awesome.css +3 -0
  11. data/examples/fragments.adoc +32 -0
  12. data/examples/fragments.css +18 -0
  13. data/examples/grid-layout-docinfo-revealjs.html +11 -0
  14. data/examples/grid-layout.adoc +174 -0
  15. data/examples/history-hash.adoc +19 -0
  16. data/examples/history-regression-tests.adoc +0 -5
  17. data/examples/history.adoc +4 -4
  18. data/examples/images/asciidoctor-logo.svg +102 -0
  19. data/examples/level-sectnums.adoc +24 -0
  20. data/examples/links-preview.adoc +32 -0
  21. data/examples/links.adoc +39 -0
  22. data/examples/release-4.0.adoc +195 -0
  23. data/examples/release-4.0.css +23 -0
  24. data/examples/source-coderay.adoc +15 -0
  25. data/examples/source-emphasis.adoc +128 -0
  26. data/examples/source-highlightjs-html.adoc +1 -1
  27. data/examples/source-highlightjs-languages.adoc +27 -0
  28. data/examples/source-highlightjs.adoc +85 -2
  29. data/examples/source-pygments.adoc +12 -0
  30. data/examples/source-rouge-docinfo.html +8 -0
  31. data/examples/source-rouge.adoc +18 -0
  32. data/examples/video.adoc +12 -3
  33. data/examples/with-docinfo-shared.adoc +13 -0
  34. data/lib/asciidoctor-revealjs/converter.rb +312 -136
  35. data/lib/asciidoctor-revealjs/highlightjs.rb +333 -2
  36. data/lib/asciidoctor-revealjs/version.rb +1 -1
  37. data/templates/asciidoctor-compatibility.css +141 -0
  38. data/templates/document.html.slim +64 -53
  39. data/templates/helpers.rb +93 -1
  40. data/templates/image.html.slim +1 -1
  41. data/templates/inline_anchor.html.slim +2 -1
  42. data/templates/inline_image.html.slim +3 -3
  43. data/templates/listing.html.slim +1 -1
  44. data/templates/section.html.slim +34 -43
  45. data/templates/stretch_nested_elements.js.slim +65 -0
  46. data/templates/title_slide.html.slim +28 -0
  47. metadata +55 -8
  48. data/examples/revealjs-features.adoc +0 -23
  49. data/templates/asciidoctor_revealjs.css.slim +0 -59
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ require 'asciidoctor'
4
4
  require 'asciidoctor/doctest'
5
5
  require 'colorize'
6
6
  require 'tilt'
7
+ require 'rake/testtask'
7
8
 
8
9
  CONVERTER_FILE = 'lib/asciidoctor-revealjs/converter.rb'
9
10
  JS_FILE = 'build/asciidoctor-reveal.js'
@@ -17,8 +18,7 @@ end
17
18
  namespace :build do
18
19
  desc 'Compile Slim templates and generate converter.rb'
19
20
  task :converter => 'clean' do
20
- # NOTE: using mode :fast by default due to a bug in ruby-beautify under Ruby 2.5
21
- # https://github.com/erniebrodeur/ruby-beautify/issues/45
21
+ # NOTE: use :pretty if you want to debug the generated code
22
22
  build_converter :fast
23
23
  end
24
24
 
@@ -40,7 +40,8 @@ namespace :build do
40
40
  mkdir_p [File.dirname(JS_FILE), File.dirname(DIST_FILE)]
41
41
  File.open(JS_FILE, 'w') do |file|
42
42
  template = File.read('src/asciidoctor-revealjs.tmpl.js')
43
- file << template.sub('//OPAL-GENERATED-CODE//', builder.to_s)
43
+ template['//OPAL-GENERATED-CODE//'] = builder.to_s
44
+ file << template
44
45
  end
45
46
  File.binwrite "#{JS_FILE}.map", builder.source_map
46
47
 
@@ -76,6 +77,7 @@ def build_converter(mode = :pretty)
76
77
  basebackend: 'html',
77
78
  outfilesuffix: '.html',
78
79
  filetype: 'html',
80
+ supports_templates: true
79
81
  },
80
82
  delegate_backend: 'html5',
81
83
  engine_opts: {
@@ -94,6 +96,11 @@ DocTest::RakeTasks.new do |t|
94
96
  t.converter_opts = { backend_name: 'revealjs' }
95
97
  end
96
98
 
99
+ Rake::TestTask.new(:test) do |t|
100
+ t.test_files = FileList['test/asciidoctor-revealjs/*_test.rb']
101
+ t.warning = false
102
+ end
103
+
97
104
  task 'prepare-converter' do
98
105
  # Run as an external process to ensure that it will not affect tests
99
106
  # environment with extra loaded modules (especially slim).
@@ -132,7 +139,8 @@ namespace :examples do
132
139
  end
133
140
  end
134
141
 
142
+ task 'test' => 'doctest'
135
143
  task 'doctest:test' => 'prepare-converter'
136
144
  task 'doctest:generate' => 'prepare-converter'
137
145
  # When no task specified, run test.
138
- task :default => :doctest
146
+ task :default => :test
@@ -36,13 +36,15 @@ Gem::Specification.new do |s|
36
36
 
37
37
  s.add_development_dependency 'rake', '~> 13.0.0'
38
38
  s.add_development_dependency 'asciidoctor-doctest', '= 2.0.0.beta.5'
39
- s.add_development_dependency 'pry', '~> 0.10.4'
39
+ s.add_development_dependency 'minitest', '~> 5.14'
40
40
  if RUBY_ENGINE != 'jruby'
41
+ s.add_development_dependency 'pry', '~> 0.12.0'
42
+ s.add_development_dependency 'irb'
41
43
  s.add_development_dependency 'pry-byebug'
42
44
  s.add_development_dependency 'pygments.rb'
43
45
  end
44
46
  s.add_development_dependency 'colorize'
45
- s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.4.2'
47
+ s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.6.0'
46
48
  s.add_development_dependency 'slim', '~> 3.0.6'
47
49
  s.add_development_dependency 'slim-htag', '~> 0.1.0'
48
50
  s.add_development_dependency 'rouge'
@@ -0,0 +1,10 @@
1
+ <script src="https://platform.twitter.com/widgets.js"></script>
2
+ <script>
3
+ twttr.widgets.createTweet(
4
+ '1214773648776744962',
5
+ document.getElementById('tweet'),
6
+ {
7
+ theme: 'white'
8
+ }
9
+ );
10
+ </script>
@@ -0,0 +1,7 @@
1
+ <meta name="generator" content="Asciidoctor reveal.js">
2
+ <style>
3
+ #tweet {
4
+ display: flex;
5
+ justify-content: center;
6
+ }
7
+ </style>
@@ -4,6 +4,7 @@
4
4
  // :header_footer:
5
5
  = Font Awesome Tests
6
6
  :icons: font
7
+ :customcss: font-awesome.css
7
8
 
8
9
  == !
9
10
 
@@ -16,7 +17,7 @@ icon:heart[size=5x]
16
17
  == !
17
18
 
18
19
  // TODO
19
- [red]
20
+ [.red]
20
21
  icon:heart[size=5x]
21
22
 
22
23
  == !
@@ -0,0 +1,3 @@
1
+ div.red > p > span.icon {
2
+ color: red;
3
+ }
@@ -0,0 +1,32 @@
1
+ // .revealjs-features
2
+ // This example tests some of reveal.js' fragments features
3
+ // :include: //body/script | //div[@class="slides"]
4
+ // :header_footer:
5
+ = Fragments
6
+ :revealjs_history: true
7
+ :revealjs_fragmentInURL: true
8
+ :customcss: fragments.css
9
+
10
+ == Fragments
11
+
12
+ [%step]
13
+ * Fragments
14
+ * Are a reveal.js feature
15
+ * Very familiar to Powerpoint users
16
+
17
+ == Fragments in URL
18
+
19
+ [%step]
20
+ * With reveal.js 3.6
21
+ * Fragments
22
+ * Can now be displayed in URLs
23
+
24
+ == Using data-fragment
25
+
26
+ [%step]
27
+ * You can now
28
+ * Do
29
+ * Fancy
30
+ * CSS Things
31
+ * With Fragments
32
+ * See `fragments.css`
@@ -0,0 +1,18 @@
1
+ @import 'https://fonts.googleapis.com/css?family=Baloo+Bhai';
2
+
3
+ section[data-fragment="2"] p {
4
+ font-family: 'Baloo Bhai', cursive;
5
+ }
6
+
7
+ section[data-fragment="3"] p {
8
+ color: black;
9
+ flex: 1;
10
+ font-size: 2em;
11
+ line-height: 1.2;
12
+ text-decoration: none;
13
+ background-image: linear-gradient(to right, yellow 0, yellow 100%);
14
+ background-position: 0 -0.1em;
15
+ background-size: 100% 100%;
16
+ background-repeat: no-repeat;
17
+ transition: background .5s;
18
+ }
@@ -0,0 +1,11 @@
1
+ <style>
2
+ .slide-background.is-half.left.green > .slide-background-content::before {
3
+ position: absolute;
4
+ content: "";
5
+ height: 100%;
6
+ width: 50%;
7
+ top: 0;
8
+ left: 0;
9
+ background: linear-gradient(61deg, #f070a8 0%, #cdb171 100%)
10
+ }
11
+ </style>
@@ -0,0 +1,174 @@
1
+ // .grid-layout
2
+ // Testing our columns roles
3
+ // :include: //div[@class="slides"]
4
+ // :header_footer:
5
+ = Grid Layout
6
+ :docinfo: private
7
+ :source-highlighter: highlight.js
8
+ :highlightjs-languages: clojure,scala
9
+ :revealjs_hash: true
10
+
11
+ [.columns]
12
+ == 2 columns
13
+
14
+ [.column]
15
+ --
16
+ * **Edgar Allen Poe**
17
+ * Sheri S. Tepper
18
+ * Bill Bryson
19
+ --
20
+
21
+ [.column]
22
+ --
23
+ Edgar Allan Poe (/poʊ/; born Edgar Poe; January 19, 1809 – October 7, 1849) was an American writer, editor, and literary critic.
24
+ --
25
+
26
+ [.columns.wrap]
27
+ == Multi-columns with wrap
28
+
29
+ [.column]
30
+ --
31
+ .Kotlin
32
+ [source,kotlin]
33
+ ----
34
+ fun main() {
35
+ println("Hello, World!")
36
+ }
37
+ ----
38
+ --
39
+
40
+ [.column]
41
+ --
42
+ .Clojure
43
+ [source,clojure]
44
+ ----
45
+ (defn -main [& args]
46
+ (println "Hello, World!"))
47
+ ----
48
+ --
49
+
50
+ [.column]
51
+ --
52
+ .Scala
53
+ [source,scala]
54
+ ----
55
+ object HelloWorld {
56
+ def main(args: Array[String]): Unit = {
57
+ println("Hello, world!")
58
+ }
59
+ }
60
+ ----
61
+ --
62
+
63
+ [.columns]
64
+ == Columns with size
65
+
66
+ [.column.is-one-third]
67
+ --
68
+ * **Kotlin**
69
+ * Java
70
+ * Scala
71
+ --
72
+
73
+ [.column]
74
+ --
75
+ Programming language for Android, mobile cross-platform
76
+ and web development, server-side, native,
77
+ and data science. Open source forever Github.
78
+ --
79
+
80
+ [.columns]
81
+ == 3 columns
82
+
83
+ [.column]
84
+ * Java
85
+ * **Kotlin**
86
+
87
+ [.column]
88
+ * Node
89
+ * **Deno**
90
+
91
+ [.column]
92
+ * Ruby
93
+ * **Crystal**
94
+
95
+
96
+ [.columns.is-half.green.left]
97
+ == !
98
+
99
+ [.column.is-half]
100
+ * Java
101
+ * **Kotlin**
102
+
103
+ [.column.is-half]
104
+ * Ruby
105
+ * **Crystal**
106
+
107
+ == Languages
108
+
109
+ We will go over languages
110
+
111
+ [.columns]
112
+ === Kotlin
113
+
114
+ [.column]
115
+ [source,kotlin]
116
+ ----
117
+ fun main() {
118
+ println("Hello, World!")
119
+ }
120
+ ----
121
+
122
+ [.column]
123
+ --
124
+ * Nice and compact
125
+ * Works well on Android
126
+ --
127
+
128
+ [.columns]
129
+ === Clojure
130
+
131
+ [.column]
132
+ [source,clojure]
133
+ ----
134
+ (defn -main [& args]
135
+ (println "Hello, World!"))
136
+ ----
137
+
138
+ [.column]
139
+ --
140
+ * Lisp-like
141
+ * Few simple concepts
142
+ --
143
+
144
+ [.columns.is-vcentered]
145
+ == Vertically Centered Columns
146
+
147
+ [.column]
148
+ * Java
149
+ * **Kotlin**
150
+
151
+ [.column]
152
+ * Node
153
+ * **Deno**
154
+
155
+ [.column.is-half]
156
+ --
157
+ .Source
158
+ [source,asciidoc]
159
+ ....
160
+ [.columns.is-vcentered]
161
+ == Vertically Aligned Columns
162
+
163
+ [.column]
164
+ * Java
165
+ * **Kotlin**
166
+
167
+ [.column]
168
+ * Node
169
+ * **Deno**
170
+
171
+ [.column.is-half]
172
+ [...]
173
+ ....
174
+ --
@@ -0,0 +1,19 @@
1
+ // .hash
2
+ // Enables reveal.js hash feature which is good to reload in-progress slides and doesn't push to browser history.
3
+ // :include: //body/script | //div[@class="slides"]
4
+ // :header_footer:
5
+ = No History
6
+ :backend: revealjs
7
+ :revealjs_hash: true
8
+
9
+ == First slide
10
+
11
+ This Deck
12
+
13
+ == Second slide
14
+
15
+ You can reload anytime
16
+
17
+ == Third slide
18
+
19
+ Yet browser history is not spammed
@@ -42,8 +42,3 @@
42
42
  == hello こんにちは
43
43
 
44
44
  == hello 你好
45
-
46
- [id=xss" onClick="javascript:alert('xss-ed')]
47
- == hello XSS
48
-
49
- security?
@@ -1,5 +1,5 @@
1
1
  // .history
2
- // Enables Reveal.JS' browser history feature
2
+ // Enables reveal.js' browser history feature
3
3
  // :include: //body/script | //div[@class="slides"]
4
4
  // :header_footer:
5
5
  = History
@@ -8,12 +8,12 @@
8
8
 
9
9
  == First slide
10
10
 
11
- Uno
11
+ This
12
12
 
13
13
  == Second slide
14
14
 
15
- Dos
15
+ Pushes
16
16
 
17
17
  == Third slide
18
18
 
19
- Tres
19
+ To Browser History Stack
@@ -0,0 +1,102 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="105.83333mm"
13
+ height="105.83333mm"
14
+ viewBox="0 0 105.83333 105.83333"
15
+ version="1.1"
16
+ id="svg3751"
17
+ inkscape:export-filename="/tmp/asciidoctor-logo-fill-color.png"
18
+ inkscape:export-xdpi="240"
19
+ inkscape:export-ydpi="240"
20
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
21
+ <title
22
+ id="title4527">Asciidoctor</title>
23
+ <defs
24
+ id="defs3745" />
25
+ <sodipodi:namedview
26
+ id="base"
27
+ pagecolor="#ffffff"
28
+ bordercolor="#666666"
29
+ borderopacity="1.0"
30
+ inkscape:pageopacity="0.0"
31
+ inkscape:pageshadow="2"
32
+ inkscape:zoom="1.6245048"
33
+ inkscape:cx="-46.777153"
34
+ inkscape:cy="24.966208"
35
+ inkscape:document-units="mm"
36
+ inkscape:current-layer="layer1"
37
+ showgrid="false"
38
+ fit-margin-top="0"
39
+ fit-margin-left="0"
40
+ fit-margin-right="0"
41
+ fit-margin-bottom="0"
42
+ inkscape:window-width="3200"
43
+ inkscape:window-height="1658"
44
+ inkscape:window-x="0"
45
+ inkscape:window-y="68"
46
+ inkscape:window-maximized="1" />
47
+ <metadata
48
+ id="metadata3748">
49
+ <rdf:RDF>
50
+ <cc:Work
51
+ rdf:about="">
52
+ <dc:format>image/svg+xml</dc:format>
53
+ <dc:type
54
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
55
+ <dc:title>Asciidoctor</dc:title>
56
+ <dc:publisher>
57
+ <cc:Agent>
58
+ <dc:title>Asciidoctor</dc:title>
59
+ </cc:Agent>
60
+ </dc:publisher>
61
+ <dc:description>Asciidoctor project logo.</dc:description>
62
+ <dc:subject>
63
+ <rdf:Bag>
64
+ <rdf:li>AsciiDoc</rdf:li>
65
+ </rdf:Bag>
66
+ </dc:subject>
67
+ <dc:relation>https://asciidoctor.org</dc:relation>
68
+ </cc:Work>
69
+ </rdf:RDF>
70
+ </metadata>
71
+ <g
72
+ inkscape:label="Layer 1"
73
+ inkscape:groupmode="layer"
74
+ id="layer1"
75
+ transform="translate(-0.083335,-191.08337)">
76
+ <path
77
+ inkscape:connector-curvature="0"
78
+ id="path907"
79
+ d="m 26.240746,191.08337 c -14.436702,0 -26.157411,11.7201 -26.157411,26.15666 v 53.51951 c 0,14.43654 11.720957,26.15715 26.157411,26.15715 H 79.76025 c 14.436679,0 26.15641,-11.72061 26.15641,-26.15715 v -53.51951 c 0,-14.43656 -11.719488,-26.15666 -26.15641,-26.15666 z"
80
+ style="clip-rule:evenodd;fill:#e40046;fill-opacity:1;fill-rule:evenodd;stroke-width:0.24752024;stroke-linejoin:round;stroke-miterlimit:1.41420996" />
81
+ <path
82
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4.46009064px;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
83
+ d="m 55.70942,210.48548 a 2.2302684,2.2302684 0 0 0 -2.015517,1.37263 l -13.327365,32.05565 a 2.2302684,2.2302684 0 1 0 4.117839,1.71171 l 11.25217,-27.06706 23.600261,57.54395 a 2.2302684,2.2302684 0 1 0 4.125976,-1.69271 L 57.814455,211.86894 a 2.2302684,2.2302684 0 0 0 -2.105035,-1.38346 z"
84
+ id="path909"
85
+ inkscape:connector-curvature="0" />
86
+ <path
87
+ inkscape:connector-curvature="0"
88
+ id="path911"
89
+ d="m 36.817184,255.95416 a 2.2302685,2.2302685 0 0 0 -2.024151,1.40272 l -7.083967,17.04249 a 2.2302685,2.2302685 0 1 0 4.118502,1.71234 l 7.083967,-17.0425 a 2.2302685,2.2302685 0 0 0 -2.094351,-3.11505 z"
90
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.46009111px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
91
+ <path
92
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4.46009111px;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
93
+ d="m 21.548721,254.55016 a 2.2302685,2.2302685 0 1 0 0,4.45963 h 25.754124 a 2.2302685,2.2302685 0 1 0 0,-4.45964 z"
94
+ id="path915"
95
+ inkscape:connector-curvature="0" />
96
+ <path
97
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4.46009111px;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
98
+ d="m 26.263348,243.9626 a 2.2302685,2.2302685 0 1 0 0,4.45962 h 25.751411 a 2.2302685,2.2302685 0 1 0 0,-4.45962 z"
99
+ id="path919"
100
+ inkscape:connector-curvature="0" />
101
+ </g>
102
+ </svg>