asciidoctor-bespoke 1.0.0.alpha.1 → 1.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.adoc +42 -0
- data/Gemfile +4 -0
- data/{LICENSE.adoc → LICENSE} +3 -4
- data/README.adoc +92 -31
- data/Rakefile +4 -6
- data/asciidoctor-bespoke.gemspec +32 -0
- data/bin/asciidoctor-bespoke +12 -0
- data/lib/asciidoctor-bespoke/converter.rb +3 -3
- data/lib/asciidoctor-bespoke/version.rb +1 -1
- data/templates/slim/document.html.slim +5 -6
- data/templates/slim/helpers.rb +1 -1
- data/templates/slim/image.html.slim +17 -12
- data/templates/slim/listing.html.slim +4 -3
- data/templates/slim/literal.html.slim +3 -2
- data/templates/slim/notes.html.slim +1 -2
- data/templates/slim/olist.html.slim +1 -1
- data/templates/slim/section.html.slim +1 -1
- data/templates/slim/slide_speaker.html.slim +1 -1
- data/templates/slim/slide_title.html.slim +2 -0
- data/templates/slim/video.html.slim +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55fed4150805c6b9d534bee77b8ee667378b89b55ca8dad228d3e13febb81df2
|
4
|
+
data.tar.gz: 4c5c4af1b09243dbb8ff16f2a324bf680334246ec93704c528225bebdd52c9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 462481c11034ae7d4b0217d86f1ea8ab8e53024eedd7fcca82213a67aaf74dac35a5043f78c60f4197876909b05ac862a6266186a6677595624641dfddb67a75
|
7
|
+
data.tar.gz: c7ce8396e25df821a5790766f63a362234c61d3fdec5fd173cbd38174d87c48b385a2800e46a57cab77fa957d3889db9ca3d196031ceb0f7f09007d6c053b0d0
|
data/CHANGELOG.adoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= {project-name} Changelog
|
2
|
+
:project-name: asciidoctor-bespoke
|
3
|
+
:uri-repo: https://github.com/asciidoctor/asciidoctor-bespoke
|
4
|
+
|
5
|
+
This document provides a high-level view of the changes introduced in {project-name} by release.
|
6
|
+
For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
|
7
|
+
|
8
|
+
== 1.0.0-alpha.2 (2023-10-28) - @mojavelinux
|
9
|
+
|
10
|
+
Added::
|
11
|
+
|
12
|
+
* implement start attribute on ordered list (#12)
|
13
|
+
* add support for link attribute on block image
|
14
|
+
* allow use of custom role on listing block (#17)
|
15
|
+
* include middle name in title slide if provided
|
16
|
+
* read end time for video from end attribute
|
17
|
+
* add support for named route hashes with bespoke-hash (#9)
|
18
|
+
* report version of converter when running asciidoctor-bespoke -v
|
19
|
+
* enable header insertion slot for docinfo
|
20
|
+
|
21
|
+
Changed::
|
22
|
+
|
23
|
+
* rename role for speaker notes to "notes"
|
24
|
+
* replace jade with pug
|
25
|
+
* upgrade Font Awesome to 4.7.0
|
26
|
+
* upgrade highlight.js to 9.12.0
|
27
|
+
|
28
|
+
Fixed::
|
29
|
+
|
30
|
+
* fix duplicate id when ordered list has title
|
31
|
+
* set backend traits correctly (#20)
|
32
|
+
|
33
|
+
=== Details
|
34
|
+
|
35
|
+
{url-repo}/releases/tag/v1.0.0-alpha.2[git tag] | {url-repo}/compare/v1.0.0.alpha.1\...v1.0.0-alpha.2[full diff]
|
36
|
+
|
37
|
+
== 1.0.0.alpha.1 (2015-03-25) - @mojavelinux
|
38
|
+
|
39
|
+
Initial release.
|
40
|
+
|
41
|
+
{uri-repo}/issues?q=milestone%3Av1.0.0.alpha.1[issues resolved] |
|
42
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.1[git tag]
|
data/Gemfile
ADDED
data/{LICENSE.adoc → LICENSE}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Copyright (C) 2015-
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (C) 2015-present Dan Allen and the Asciidoctor Project
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
THE SOFTWARE.
|
22
|
-
....
|
data/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= {project-name}
|
2
2
|
Dan Allen <https://github.com/mojavelinux>
|
3
|
-
v1.0.0
|
3
|
+
v1.0.0-alpha.2, 2023-10-28
|
4
4
|
// Settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -12,6 +12,7 @@ ifdef::env-github,env-browser[]
|
|
12
12
|
:toclevels: 2
|
13
13
|
endif::[]
|
14
14
|
ifdef::env-github[]
|
15
|
+
:status:
|
15
16
|
:outfilesuffix: .adoc
|
16
17
|
:!toc-title:
|
17
18
|
:caution-caption: :fire:
|
@@ -46,17 +47,22 @@ endif::[]
|
|
46
47
|
:uri-svgo: https://github.com/svg/svgo
|
47
48
|
:uri-yo-bespoke: https://github.com/bespokejs/generator-bespoke
|
48
49
|
|
50
|
+
ifdef::status[]
|
51
|
+
image:https://img.shields.io/gem/v/asciidoctor-bespoke.svg?label=gem[gem badge, link=https://rubygems.org/gems/asciidoctor-bespoke]
|
52
|
+
endif::[]
|
53
|
+
|
49
54
|
An {uri-asciidoctor}[Asciidoctor] converter that generates the HTML component of a {uri-bespoke}[Bespoke.js] presentation from AsciiDoc.
|
50
55
|
|
51
56
|
== Overview
|
52
57
|
|
53
|
-
The goal of {project-name} is to enable you to craft HTML-based presentations from reusable content while avoiding the tedium of writing HTML
|
58
|
+
The goal of {project-name} is to enable you to craft HTML-based presentations from reusable content while avoiding the tedium of writing HTML.
|
54
59
|
This library satisfies that goal by providing a converter that generates the HTML component of a Bespoke.js presentation from an AsciiDoc document.
|
55
60
|
In other words, it allows you to use AsciiDoc in place of HTML (or an HTML template language like Jade) in your Bespoke.js project.
|
56
61
|
(You still need to add an ample amount of CSS in order to achieve the presentation style you want).
|
57
62
|
|
58
63
|
The converter works in tandem with a typical JavaScript project structure based on npm and Gulp.
|
59
|
-
npm is used to manage dependencies
|
64
|
+
npm is used to manage dependencies.
|
65
|
+
A Gulp build is used to combine and "`browserify`" the JavaScript, compile the CSS, execute this converter (to convert AsciiDoc to HTML), launch the preview server and publish the presentation files.
|
60
66
|
|
61
67
|
The converter is implemented as a collection of Slim templates, which are packaged for your convenience as an Asciidoctor converter.
|
62
68
|
The templates come into play when you want to customize the HTML the converter generates.
|
@@ -65,15 +71,17 @@ This guide explains how to integrate the {project-name} converter into an existi
|
|
65
71
|
|
66
72
|
== Prerequisites
|
67
73
|
|
68
|
-
In order to use {project-name}, you must
|
74
|
+
In order to use {project-name}, you must satisfy the prerequisites of both Bespoke.js and Asciidoctor.
|
75
|
+
You also need a Bespoke.js project.
|
76
|
+
|
77
|
+
=== For Bespoke.js
|
69
78
|
|
70
|
-
For Bespoke.js::
|
71
79
|
. {uri-nodejs}[Node.js] >= 0.12 footnote:[We strongly recommend using {uri-nvm}[nvm] to manage Node.]
|
72
80
|
. {uri-gulp}[Gulp] (command line interface only)
|
73
81
|
|
74
82
|
$ npm install -g gulp-cli
|
75
83
|
|
76
|
-
For Asciidoctor
|
84
|
+
=== For Asciidoctor
|
77
85
|
|
78
86
|
. {uri-ruby}[Ruby] >= 2 footnote:[We strongly recommend using {uri-rvm}[RVM] to manage Ruby.]
|
79
87
|
. {uri-bundler}[Bundler]
|
@@ -81,8 +89,10 @@ For Asciidoctor::
|
|
81
89
|
$ rvm use 2.3.0 --install # (optional)
|
82
90
|
$ gem install bundler
|
83
91
|
|
92
|
+
=== Bespoke.js Project
|
93
|
+
|
84
94
|
Naturally, you'll also need a Bespoke.js project, just as you would for any Bespoke.js presentation.
|
85
|
-
If you don't yet have a Bespoke.js project, you can clone the
|
95
|
+
If you don't yet have a Bespoke.js project, you can clone the provided https://github.com/opendevise/presentation-bespoke-starter[starter project]:
|
86
96
|
|
87
97
|
$ git clone https://github.com/opendevise/presentation-bespoke-starter
|
88
98
|
|
@@ -94,11 +104,11 @@ In the future, we plan to provide an updated Yeoman generator that incorporates
|
|
94
104
|
|
95
105
|
Once you've initialized your Bespoke.js project, the next task is to replace Jade with AsciiDoc.
|
96
106
|
|
97
|
-
TIP: If you're creating a new project using the starter project previously mentioned,
|
98
|
-
If you're curious, you can review https://github.com/opendevise/presentation-bespoke-starter/compare/asciidoc?diff=split[
|
107
|
+
TIP: If you're creating a new project using the starter project previously mentioned, you can switch to the https://github.com/opendevise/presentation-bespoke-starter/tree/asciidoc[asciidoc branch] in that repository to skip past the steps in this section and jump ahead to <<Creating Slides in AsciiDoc>>.
|
108
|
+
If you're curious, you can review https://github.com/opendevise/presentation-bespoke-starter/compare/asciidoc?diff=split[a diff] that contains the changes this section goes on to cover.
|
99
109
|
|
100
110
|
The first step is to configure Bundler to fetch and install the required gems.
|
101
|
-
Create
|
111
|
+
Create a file named [.path]_Gemfile_ at the root of the project and populate it with the following content:
|
102
112
|
|
103
113
|
.Gemfile
|
104
114
|
[source,ruby,subs=attributes+]
|
@@ -110,17 +120,17 @@ gem 'asciidoctor-bespoke', '{latest-release}'
|
|
110
120
|
#gem 'asciidoctor-bespoke', github: 'asciidoctor/asciidoctor-bespoke'
|
111
121
|
----
|
112
122
|
|
113
|
-
Next, run `bundle` from the root of the project to install the gems and any dependencies:
|
123
|
+
Next, run `bundle` from the root of the project to install the gems and any dependencies they have:
|
114
124
|
|
115
125
|
$ bundle
|
116
126
|
|
117
127
|
[TIP]
|
118
128
|
====
|
119
|
-
If you want to install the gems inside the project, you can pass the `--path` argument to
|
129
|
+
If you want to install the gems inside the project, you can pass the `--path` argument to `.bundle/gems`.
|
120
130
|
|
121
|
-
$ bundle --path
|
131
|
+
$ bundle --path=.bundle/gems
|
122
132
|
|
123
|
-
The `bundle` command will remember this setting
|
133
|
+
The `bundle` command will remember this setting for all successive invocations.
|
124
134
|
====
|
125
135
|
|
126
136
|
The next step is to get the converter to generate the HTML from AsciiDoc when the presentation build runs.
|
@@ -137,17 +147,17 @@ Save the file and run `npm i` to install the new packages into your project:
|
|
137
147
|
|
138
148
|
$ npm i
|
139
149
|
|
140
|
-
Open [.path]_gulpfile.js_ and add the following entries to the list of
|
150
|
+
Open [.path]_gulpfile.js_ and add the following entries to the list of `require` calls at the top of the file:
|
141
151
|
|
142
152
|
.gulpfile.js (snippet)
|
143
153
|
[source,js]
|
144
154
|
chmod = require('gulp-chmod'),
|
145
155
|
exec = require('gulp-exec'),
|
146
156
|
|
147
|
-
|
157
|
+
Also in [.path]_gulpfile.js_, replace the existing `html` task with the one below:
|
148
158
|
|
149
159
|
.gulpfile.js (snippet)
|
150
|
-
[source,js
|
160
|
+
[source,js]
|
151
161
|
gulp.task('html', ['clean:html'], function() {
|
152
162
|
return gulp.src('src/index.adoc')
|
153
163
|
.pipe(isDist ? through() : plumber())
|
@@ -161,11 +171,11 @@ gulp.task('html', ['clean:html'], function() {
|
|
161
171
|
|
162
172
|
//<1> Add `bundle exec` in front of the `asciidoctor-bespoke` command if you're using the development version from git.
|
163
173
|
|
164
|
-
Finally,
|
174
|
+
Finally, to get the build to watch the AsciiDoc file(s) for changes, look for the following line in the watch task in [.path]_gulpfile.js_:
|
165
175
|
|
166
176
|
.gulpfile.js (snippet)
|
167
177
|
[source,js]
|
168
|
-
gulp.watch('src/**/*.
|
178
|
+
gulp.watch('src/**/*.pug', ['html']);
|
169
179
|
|
170
180
|
and replace it with:
|
171
181
|
|
@@ -173,7 +183,7 @@ and replace it with:
|
|
173
183
|
[source,js]
|
174
184
|
gulp.watch('src/**/*.adoc', ['html']);
|
175
185
|
|
176
|
-
The build is now ready
|
186
|
+
The build is now ready!
|
177
187
|
Before we can use our new task, we need to create slide content in AsciiDoc.
|
178
188
|
|
179
189
|
== Creating Slides in AsciiDoc
|
@@ -198,7 +208,7 @@ To add this presentation to your project, create the file [.path]_src/index.adoc
|
|
198
208
|
|
199
209
|
Believe it or not, that's all it takes to make a presentation!
|
200
210
|
|
201
|
-
Here's a close approximation of the HTML the converter generates
|
211
|
+
Here's a close approximation of the HTML the converter generates from the example shown above (formatted for clarity).
|
202
212
|
|
203
213
|
[source,html]
|
204
214
|
----
|
@@ -227,12 +237,12 @@ Here's a close approximation of the HTML the converter generates for the simple
|
|
227
237
|
|
228
238
|
There are a few things you should notice:
|
229
239
|
|
230
|
-
* Each slide is represented as a `<section>`, which is generated
|
231
|
-
- At runtime, Bespoke.js
|
240
|
+
* Each slide is represented as a `<section>`, which is generated per section title.
|
241
|
+
- At runtime, Bespoke.js adds additional classes to each `<section>`, including `bespoke-slide`.
|
232
242
|
* The title slide has the class `title` and uses an `<h1>` heading.
|
233
243
|
* The section title for each content slide gets put in an `<h2>` heading.
|
234
244
|
* The presentation is wrapped in an `<article>` element with the class `deck`.
|
235
|
-
- At runtime, Bespoke.js
|
245
|
+
- At runtime, Bespoke.js adds additional classes to `<article>`, including `bespoke-parent`.
|
236
246
|
* CSS is used to accomplish most of the styling and layout, so you'll need to spend some time on it.
|
237
247
|
* The JavaScript and CSS to power the Bespoke.js presentation are loaded from the [.path]_build/_ folder.
|
238
248
|
|
@@ -256,6 +266,7 @@ The slide then incorporates additional information from the following attributes
|
|
256
266
|
* preamble content
|
257
267
|
|
258
268
|
NOTE: The title slide is a built-in transform mapped to the {uri-repo-file-prefix}templates/slim/slide_title.html.slim[slide_title.html.slim] template, which you can override.
|
269
|
+
See <<Custom Transforms>> for information about where to put this file and how to load it.
|
259
270
|
You'll need to incorporate CSS (optionally using the Stylus syntax) to arrange and style the title page.
|
260
271
|
|
261
272
|
Here's an example of an AsciiDoc document that generates a title slide that is fully populated:
|
@@ -270,12 +281,12 @@ Author Name <http://example.com>
|
|
270
281
|
:avatar: author-avatar.png
|
271
282
|
:!sectids:
|
272
283
|
|
273
|
-
Additional content for title slide.
|
284
|
+
Additional content for the title slide.
|
274
285
|
|
275
286
|
== First Topic
|
276
287
|
----
|
277
288
|
|
278
|
-
If you don't want the title slide to be created, add the `noheader` attribute to the document header
|
289
|
+
If you don't want the title slide to be created, add the `noheader` attribute to the document header.
|
279
290
|
|
280
291
|
.A presentation without a title slide
|
281
292
|
[source,asciidoc]
|
@@ -287,6 +298,8 @@ If you don't want the title slide to be created, add the `noheader` attribute to
|
|
287
298
|
== First Topic
|
288
299
|
----
|
289
300
|
|
301
|
+
Another option is to simply leave out the document header altogether.
|
302
|
+
|
290
303
|
=== Content Slides
|
291
304
|
|
292
305
|
Each content slide is created from a level-1 section title.
|
@@ -307,7 +320,7 @@ Here's an example of a typical content slide with a heading:
|
|
307
320
|
----
|
308
321
|
|
309
322
|
While many of your slides may have a primary heading--perhaps as the only content on the slide--there are many slide types that don't require a heading.
|
310
|
-
You can
|
323
|
+
You can mark a slide without a heading by using `!` as the section title.
|
311
324
|
Here's an example:
|
312
325
|
|
313
326
|
.A slide with only content (i.e., an anonymous slide)
|
@@ -317,7 +330,7 @@ Here's an example:
|
|
317
330
|
image::chart.svg[]
|
318
331
|
----
|
319
332
|
|
320
|
-
If you want to assign a title to a slide, but
|
333
|
+
If you still want to assign a title to a slide, but not show it, you can add the option named `conceal`.
|
321
334
|
|
322
335
|
.A slide with a concealed heading
|
323
336
|
[source,asciidoc]
|
@@ -336,6 +349,15 @@ A shorthand for the conceal option is to prefix the section title with a `!`.
|
|
336
349
|
image::chart.svg[]
|
337
350
|
----
|
338
351
|
|
352
|
+
You can also add a named hash to a slide so you get a URL like `/#intro` instead of `/#3`.
|
353
|
+
|
354
|
+
.A slide with a named hash (aka named route)
|
355
|
+
[source,asciidoc]
|
356
|
+
----
|
357
|
+
[#intro]
|
358
|
+
= Intro
|
359
|
+
----
|
360
|
+
|
339
361
|
Notice how we're keeping the concerns of content and presentation cleanly separated.
|
340
362
|
Using very little AsciiDoc, you're able to describe a lot of different functionality.
|
341
363
|
There doesn't even have to be a direct, literal mapping between the AsciiDoc and the HTML.
|
@@ -362,6 +384,7 @@ The speaker slide currently incorporates the following attributes:
|
|
362
384
|
* section content (if any)
|
363
385
|
|
364
386
|
NOTE: The speaker slide is a built-in transform mapped to the {uri-repo-file-prefix}templates/slim/slide_speaker.html.slim[slide_speaker.html.slim] template, which you can override.
|
387
|
+
See <<Custom Transforms>> for information about where to put this file and how to load it.
|
365
388
|
|
366
389
|
Here's a rough approximation of the HTML generated for the speaker slide:
|
367
390
|
|
@@ -521,6 +544,7 @@ The effects supported out of the box are as follows:
|
|
521
544
|
|
522
545
|
* fade
|
523
546
|
* vanish
|
547
|
+
* spotlight (planned)
|
524
548
|
* replace (planned)
|
525
549
|
|
526
550
|
The CSS in the <<Build Configuration>> section implements these effects.
|
@@ -653,6 +677,43 @@ Topic has the following benefits:
|
|
653
677
|
|
654
678
|
To learn more about how to setup a presentation console, see the https://github.com/opendevise/bespoke-onstage[bespoke-onstage plugin].
|
655
679
|
|
680
|
+
=== Supplemental Content
|
681
|
+
|
682
|
+
It's possible to inject supplemental content into the output document using http://asciidoctor.org/docs/user-manual/#docinfo-file[docinfo files].
|
683
|
+
This core feature of AsciiDoc has been adapted to work with the Bespoke converter.
|
684
|
+
|
685
|
+
Currently, there are three insertion locations for docinfo content in a Bespoke document:
|
686
|
+
|
687
|
+
head:: content is inserted after the last child of the `<head>` element
|
688
|
+
header:: content is inserted before the first child of the `<article>` element (before the slides)
|
689
|
+
footer:: content is inserted after the last child of the `<article>` element (after the slides)
|
690
|
+
|
691
|
+
The content you want to insert goes into a sibling file of the slide deck document with the following filename pattern:
|
692
|
+
|
693
|
+
docinfo-<location>-bespoke.html
|
694
|
+
|
695
|
+
For example, let's say you want to embed a tweet into your slide deck.
|
696
|
+
You might inject the shared embedding JavaScript using a footer docinfo file:
|
697
|
+
|
698
|
+
.src/docinfo-footer-bespoke.html
|
699
|
+
[source,html]
|
700
|
+
----
|
701
|
+
<script src="https://platform.twitter.com/widgets.js"></script>
|
702
|
+
----
|
703
|
+
|
704
|
+
You then need to set the following document attribute in the AsciiDoc header:
|
705
|
+
|
706
|
+
----
|
707
|
+
:docinfo: shared
|
708
|
+
----
|
709
|
+
|
710
|
+
When this attribute is defined, the converter will automatically read the docinfo file(s) and insert the contents into the specified location in the output document.
|
711
|
+
|
712
|
+
If you want to include content in every slide, we recommend using a http://asciidoctor.org/docs/user-manual/#extension-points[tree processor extension].
|
713
|
+
The tree processor would first query for all the level-1 sections in the document (which get transformed into slides), then append one or more blocks to each of the matched sections.
|
714
|
+
The tree processor could even read this content from a shared file.
|
715
|
+
In the future, the converter may support docinfo insertions per slide.
|
716
|
+
|
656
717
|
=== Custom Transforms
|
657
718
|
|
658
719
|
While conversion from AsciiDoc is meant to save you time producing common slide types, there are cases when you find yourself going against the grain or exceeding the limits of what CSS can handle.
|
@@ -801,7 +862,7 @@ Bespoke.js was created by https://github.com/markdalgleish[Mark Dalgleish] and h
|
|
801
862
|
|
802
863
|
=== Copyright
|
803
864
|
|
804
|
-
Copyright (C) 2015-
|
865
|
+
Copyright (C) 2015-present Dan Allen and the Asciidoctor Project.
|
866
|
+
Use of this software is granted under the terms of the MIT License.
|
805
867
|
|
806
|
-
|
807
|
-
See the <<LICENSE#,LICENSE>> file for details.
|
868
|
+
See the link:LICENCE[LICENSE] file for the full license text.
|
data/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
rescue LoadError => e
|
4
|
-
warn e.message
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
3
|
+
$default_tasks = [] # rubocop:disable Style/GlobalVars
|
4
|
+
Dir.glob('tasks/*.rake').each {|file| load file }
|
5
|
+
task default: $default_tasks unless $default_tasks.empty? # rubocop:disable Style/GlobalVars
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path '../lib/asciidoctor-bespoke/version', __FILE__
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'asciidoctor-bespoke'
|
6
|
+
s.version = Asciidoctor::Bespoke::VERSION
|
7
|
+
s.authors = ['Dan Allen']
|
8
|
+
s.email = ['dan.j.allen@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/asciidoctor/asciidoctor-bespoke'
|
10
|
+
s.summary = 'Converts AsciiDoc to HTML for a Bespoke.js presentation'
|
11
|
+
s.description = 'An Asciidoctor converter that generates the HTML component of a Bespoke.js presentation from AsciiDoc.'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.required_ruby_version = '>= 1.9.3'
|
14
|
+
|
15
|
+
files = begin
|
16
|
+
(result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split %(\0)).empty? ? Dir['**/*'] : result
|
17
|
+
rescue
|
18
|
+
Dir['**/*']
|
19
|
+
end
|
20
|
+
s.files = files.grep %r/^(?:(?:lib|templates)\/.+|Gemfile|Rakefile|LICENSE|(?:CHANGELOG|README)\.adoc|#{s.name}\.gemspec)$/
|
21
|
+
|
22
|
+
s.executables = ['asciidoctor-bespoke']
|
23
|
+
s.extra_rdoc_files = ['CHANGELOG.adoc', 'LICENSE', 'README.adoc']
|
24
|
+
s.require_paths = ['lib']
|
25
|
+
|
26
|
+
# QUESTION should asciidoctor be a runtime dependency?
|
27
|
+
s.add_runtime_dependency 'asciidoctor', '>= 1.5.0'
|
28
|
+
s.add_runtime_dependency 'slim', '~> 3.0.6'
|
29
|
+
s.add_runtime_dependency 'thread_safe', '~> 0.3.5'
|
30
|
+
|
31
|
+
s.add_development_dependency 'rake', '~> 10.4.2'
|
32
|
+
end
|
data/bin/asciidoctor-bespoke
CHANGED
@@ -9,6 +9,18 @@ require 'asciidoctor/cli'
|
|
9
9
|
|
10
10
|
options = Asciidoctor::Cli::Options.new backend: 'bespoke'
|
11
11
|
|
12
|
+
# FIXME provide an API in Asciidoctor for sub-components to print version information
|
13
|
+
unless ARGV != ['-v'] && (ARGV & ['-V', '--version']).empty?
|
14
|
+
$stdout.write %(Asciidoctor Bespoke #{Asciidoctor::Bespoke::VERSION} using )
|
15
|
+
# NOTE the print_version method was added in Asciidoctor 1.5.2
|
16
|
+
if options.respond_to? :print_version
|
17
|
+
options.print_version
|
18
|
+
else
|
19
|
+
puts %(Asciidoctor #{::Asciidoctor::VERSION} [http://asciidoctor.org])
|
20
|
+
end
|
21
|
+
exit 0
|
22
|
+
end
|
23
|
+
|
12
24
|
# FIXME This is a really bizarre API. Please make me simpler.
|
13
25
|
if Integer === (result = options.parse! ARGV)
|
14
26
|
exit result
|
@@ -28,9 +28,9 @@ module Bespoke
|
|
28
28
|
template_opts = opts.merge htmlsyntax: 'html', template_engine: 'slim', template_engine_options: engine_opts
|
29
29
|
template_converter = ::Asciidoctor::Converter::TemplateConverter.new backend, template_dirs, template_opts
|
30
30
|
html5_converter = ::Asciidoctor::Converter::Html5Converter.new backend, opts
|
31
|
-
super
|
32
|
-
|
33
|
-
|
31
|
+
super 'html5', template_converter, html5_converter
|
32
|
+
backend_info
|
33
|
+
@backend = backend
|
34
34
|
end
|
35
35
|
|
36
36
|
def convert node, transform = nil, opts = {}
|
@@ -21,22 +21,21 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
|
|
21
21
|
link rel='stylesheet' href='build/build.css'
|
22
22
|
- if attr? :icons, 'font'
|
23
23
|
- if attr? 'iconfont-remote'
|
24
|
-
link rel='stylesheet' href=(attr 'iconfont-cdn', (cdn_uri 'font-awesome', '4.
|
24
|
+
link rel='stylesheet' href=(attr 'iconfont-cdn', (cdn_uri 'font-awesome', '4.7.0', 'css/font-awesome.min.css'))
|
25
25
|
- else
|
26
26
|
link rel='stylesheet' href=(normalize_web_path 'font-awesome.css', (attr :stylesdir, ''))
|
27
27
|
- case (_source_highlighter = attr 'source-highlighter')
|
28
28
|
- when 'highlight.js'
|
29
|
-
link rel='stylesheet' href="#{_highlightjs_path = attr
|
29
|
+
link rel='stylesheet' href="#{_highlightjs_path = attr :highlightjsdir, (cdn_uri 'highlight.js', '9.12.0')}/styles/#{attr 'highlightjs-theme', 'github'}.min.css"
|
30
30
|
- when 'prettify'
|
31
|
-
link rel='stylesheet' href="#{_prettify_path = attr
|
31
|
+
link rel='stylesheet' href="#{_prettify_path = attr :prettifydir, (cdn_uri 'prettify', 'r298')}/#{attr 'prettify-theme', 'prettify'}.min.css"
|
32
32
|
- unless (_docinfo = docinfo :head, '-bespoke.html').empty?
|
33
33
|
=_docinfo
|
34
34
|
body id=id
|
35
35
|
article.deck
|
36
36
|
- unless noheader
|
37
|
-
|
38
|
-
|
39
|
-
/ =_docinfo
|
37
|
+
- unless (_docinfo = docinfo :header, '-bespoke.html').empty?
|
38
|
+
=_docinfo
|
40
39
|
- if header?
|
41
40
|
include slide_title.html.slim
|
42
41
|
=content
|
data/templates/slim/helpers.rb
CHANGED
@@ -1,20 +1,25 @@
|
|
1
|
-
- _target, _alt, _width, _height, _format, _reload = (local_attr :target), (local_attr :alt), (local_attr :width), (local_attr :height), (local_attr :format), ('true' if option? :reload)
|
1
|
+
- _target, _alt, _width, _height, _format, _link, _reload = (local_attr :target), (local_attr :alt), (local_attr :width), (local_attr :height), (local_attr :format), (local_attr :link), ('true' if option? :reload)
|
2
2
|
/ QUESTION support default image role?
|
3
3
|
figure.image id=id class=[role, ('flux' if option? :flux)]
|
4
|
-
/ TODO
|
5
|
-
/ TODO append an index/counter to the alt attribute (since it is otherwise shared)
|
4
|
+
/ TODO append an index/counter to the alt attribute (since it's otherwise shared)
|
6
5
|
- _target.split(/[#,]/).each do |_target|
|
7
6
|
=newline
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
/
|
15
|
-
|
7
|
+
- content_for :img
|
8
|
+
- if _format == 'svg' || (_target.include? '.svg') && ((_svg = option? :inline) || (_obj = option? :interactive))
|
9
|
+
- case
|
10
|
+
- when _svg
|
11
|
+
=include_svg _target
|
12
|
+
- when _obj
|
13
|
+
object type='image/svg+xml' data=(image_uri _target) width=_width height=_height data-reload=_reload
|
14
|
+
/ TODO support fallback option
|
15
|
+
span.alt=_alt
|
16
|
+
- else
|
17
|
+
img src=(image_uri _target) alt=_alt width=_width height=_height data-reload=_reload
|
18
|
+
- if _link
|
19
|
+
a.image href=_link
|
20
|
+
- yield_content :img
|
16
21
|
- else
|
17
|
-
|
22
|
+
- yield_content :img
|
18
23
|
- if title?
|
19
24
|
=newline
|
20
25
|
figcaption=title
|
@@ -1,14 +1,15 @@
|
|
1
1
|
- _has_title = title?
|
2
|
+
- _role = role
|
2
3
|
- content_for :pre
|
3
4
|
- if style == 'source' && (_lang = local_attr :language)
|
4
5
|
/ NOTE class attribute required for highlight.js and prettify
|
5
6
|
/ QUESTION should we add a "highlight" class to pre?
|
6
|
-
pre.source id=(id unless _has_title) : code data-lang=_lang class="language-#{_lang} prettyprint" =content
|
7
|
+
pre.source id=(id unless _has_title) class=_role : code data-lang=_lang class="language-#{_lang} prettyprint" =content
|
7
8
|
- else
|
8
9
|
/ QUESTION should we add a class to pre?
|
9
|
-
pre id=(id unless _has_title) : code =content
|
10
|
+
pre id=(id unless _has_title) class=_role : code =content
|
10
11
|
- if _has_title
|
11
|
-
figure.listing id=id
|
12
|
+
figure.listing id=id class=_role
|
12
13
|
figcaption=title
|
13
14
|
- yield_content :pre
|
14
15
|
- else
|
@@ -1,9 +1,10 @@
|
|
1
1
|
// NOTE if style is not set, then it's a literal paragraph (not a literal block)
|
2
2
|
- _has_title = title?
|
3
|
+
- _role = role
|
3
4
|
- content_for :pre
|
4
|
-
pre.screen id=(id unless _has_title) class=
|
5
|
+
pre.screen id=(id unless _has_title) class=_role : samp =content
|
5
6
|
- if _has_title
|
6
|
-
figure.listing id=id
|
7
|
+
figure.listing id=id class=_role
|
7
8
|
figcaption=title
|
8
9
|
- yield_content :pre
|
9
10
|
- else
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
aside role='note' =resolve_content
|
1
|
+
aside role='notes' =resolve_content
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- _has_title = title?
|
2
2
|
- content_for :ol
|
3
|
-
ol id=id class=[(style unless style == 'arabic'), ('fit' if (_fit = option? :fit)), *build_roles, role] reversed=('true' if option? :reversed)
|
3
|
+
ol id=(id unless _has_title) class=[(style unless style == 'arabic'), ('fit' if (_fit = option? :fit)), *build_roles, role] start=(local_attr :start) reversed=('true' if option? :reversed)
|
4
4
|
- items.each do |_item|
|
5
5
|
li class=('line' if _fit)
|
6
6
|
span.primary=_item.text
|
@@ -9,7 +9,7 @@
|
|
9
9
|
- _style = nil
|
10
10
|
- if (_bg_img = pluck_first context: :image, role: 'canvas')
|
11
11
|
- _style = %[background-image: url(#{image_uri _bg_img.attr(:target)}); background-size: #{(_bg_img.roles & %w[cover contain])[0] || 'cover'}; background-repeat: no-repeat]
|
12
|
-
section id=_id class=[*_roles, ('image' if _bg_img)] style=_style data-title=(local_attr
|
12
|
+
section id=_id class=[*_roles, ('image' if _bg_img)] style=_style data-title=(local_attr :reftext) data-bespoke-backdrop=(local_attr 'backdrop-role')
|
13
13
|
- content_for :content
|
14
14
|
- unless (_title.start_with? '!') || (option? :conceal)
|
15
15
|
- if (_title_obj = partition_title _title).subtitle?
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- _id = (_id = id) && title == '!' && !(local_attr? :id) ? nil : _id
|
3
3
|
- _editable = (option? :editable) ? 'true' : nil
|
4
4
|
- _spellcheck = _editable ? 'false' : nil
|
5
|
-
section.speaker id=_id class=role data-title=(local_attr
|
5
|
+
section.speaker id=_id class=role data-title=(local_attr :reftext)
|
6
6
|
header
|
7
7
|
h2 contenteditable=_editable spellcheck=_spellcheck =_author
|
8
8
|
h3 contenteditable=_editable spellcheck=_spellcheck =document.attr :position
|
@@ -22,6 +22,8 @@ section.title id=header.id class=[role, ('image' if _bg_img)] style=_style data-
|
|
22
22
|
p.author
|
23
23
|
span.personname
|
24
24
|
span.firstname=>attr :firstname
|
25
|
+
- if (attr? :middlename)
|
26
|
+
span.middlename=>attr :middlename
|
25
27
|
span.surname=attr :lastname
|
26
28
|
- if (attr? :position) || (attr? :organization)
|
27
29
|
=newline
|
@@ -20,7 +20,7 @@ figure.video class=_service id=id class=role
|
|
20
20
|
- _params = ['enablejsapi=1', 'rel=0', 'showinfo=0', 'controls=0', 'disablekb=1']
|
21
21
|
/ NOTE start and end must be in seconds
|
22
22
|
- _params << %(start=#{local_attr :start}) if local_attr? :start
|
23
|
-
- _params << %(end=#{local_attr :
|
23
|
+
- _params << %(end=#{local_attr :end}) if local_attr? :end
|
24
24
|
- _params += ['loop=1', %(playlist=#{_target})] if option? :loop
|
25
25
|
- _params << 'fs=0' if option? :nofullscreen
|
26
26
|
- _params << %(hl=#{document.attr :lang}) if document.attr? :lang
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-bespoke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -74,12 +74,16 @@ executables:
|
|
74
74
|
- asciidoctor-bespoke
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files:
|
77
|
+
- CHANGELOG.adoc
|
78
|
+
- LICENSE
|
77
79
|
- README.adoc
|
78
|
-
- LICENSE.adoc
|
79
80
|
files:
|
80
|
-
-
|
81
|
+
- CHANGELOG.adoc
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE
|
81
84
|
- README.adoc
|
82
85
|
- Rakefile
|
86
|
+
- asciidoctor-bespoke.gemspec
|
83
87
|
- bin/asciidoctor-bespoke
|
84
88
|
- lib/asciidoctor-bespoke.rb
|
85
89
|
- lib/asciidoctor-bespoke/converter.rb
|
@@ -121,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
125
|
- !ruby/object:Gem::Version
|
122
126
|
version: 1.3.1
|
123
127
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.5.1
|
128
|
+
rubygems_version: 3.1.6
|
126
129
|
signing_key:
|
127
130
|
specification_version: 4
|
128
131
|
summary: Converts AsciiDoc to HTML for a Bespoke.js presentation
|