Skip to content

Commit 5f8d77d

Browse files
committed
upgrade Asciidoctor.js used in UI preview [skip ci]
1 parent d277939 commit 5f8d77d

File tree

4 files changed

+56
-52
lines changed

4 files changed

+56
-52
lines changed

gulp.d/tasks/build-preview-pages.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
'use strict'
22

3-
// NOTE remove patch after upgrading from asciidoctor.js to @asciidoctor/core
4-
Error.call = (self, ...args) => {
5-
const err = new Error(...args)
6-
return Object.assign(self, { message: err.message, stack: err.stack })
7-
}
8-
9-
const asciidoctor = require('asciidoctor.js')()
3+
const Asciidoctor = require('@asciidoctor/core')()
104
const fs = require('fs')
115
const { promises: fsp } = fs
126
const handlebars = require('handlebars')
@@ -43,7 +37,7 @@ module.exports = (src, previewSrc, previewDest, sink = () => map()) => (done) =>
4337
if (file.stem === '404') {
4438
uiModel.page = { layout: '404', title: 'Page Not Found' }
4539
} else {
46-
const doc = asciidoctor.load(file.contents, { safe: 'safe', attributes: ASCIIDOC_ATTRIBUTES })
40+
const doc = Asciidoctor.load(file.contents, { safe: 'safe', attributes: ASCIIDOC_ATTRIBUTES })
4741
uiModel.page.attributes = Object.entries(doc.getAttributes())
4842
.filter(([name, val]) => name.startsWith('page-'))
4943
.reduce((accum, [name, val]) => {

package-lock.json

Lines changed: 38 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"devDependencies": {
2020
"@octokit/rest": "~18.0",
21-
"asciidoctor.js": "1.5.9",
21+
"@asciidoctor/core": "~2.2",
2222
"autoprefixer": "~10.0",
2323
"browser-pack-flat": "~3.4",
2424
"browserify": "~17.0",

preview-src/index.adoc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Lorem pertinacia `expetenda` et nec, [.underline]#wisi# illud [.line-through]#so
2525
Eum an doctus <<liber-recusabo,maiestatis efficiantur>>.
2626
Eu mea inani iriure.
2727

28-
[source,json]
28+
[,json]
2929
----
3030
{
3131
"name": "module-name",
@@ -40,7 +40,7 @@ Eu mea inani iriure.
4040
----
4141

4242
.Example paragraph syntax
43-
[source,asciidoc]
43+
[,asciidoc]
4444
----
4545
.Optional title
4646
[example]
@@ -51,23 +51,29 @@ This is an example paragraph.
5151
[example]
5252
This is an example paragraph.
5353

54+
.Summary
55+
[%collapsible]
56+
====
57+
Loads of details.
58+
====
59+
5460
=== Some Code
5561

5662
How about some code?
5763

58-
[source,js]
64+
[,js]
5965
----
6066
vfs
6167
.src('js/vendor/*.js', { cwd: 'src', cwdbase: true, read: false })
62-
.pipe(tap((file) => { // <1>
68+
.pipe(tap((file) => { // <.>
6369
file.contents = browserify(file.relative, { basedir: 'src', detectGlobals: false }).bundle()
6470
}))
65-
.pipe(buffer()) // <2>
71+
.pipe(buffer()) // <.>
6672
.pipe(uglify())
6773
.pipe(gulp.dest('build'))
6874
----
69-
<1> The tap function is used to wiretap the data in the pipe.
70-
<2> Wrap each streaming file in a buffer so the files can be processed by uglify.
75+
<.> The tap function is used to wiretap the data in the pipe.
76+
<.> Wrap each streaming file in a buffer so the files can be processed by uglify.
7177
Uglify can only work with buffers, not streams.
7278

7379
Execute these commands to validate and build your site:
@@ -105,7 +111,7 @@ m|"foo\nbar"
105111
l|foo
106112
bar
107113
a|
108-
[source,ruby]
114+
[,ruby]
109115
----
110116
puts "foo\nbar"
111117
----
@@ -264,7 +270,7 @@ Make the switch today!
264270
Altera atomorum his ex, has cu elitr melius propriae.
265271
Eos suscipit scaevola at.
266272

267-
[quote, 'Famous Person. Cum dicat putant ne.', 'Cum dicat putant ne. https://example.com[Famous Person Website]']
273+
[,'Famous Person. Cum dicat putant ne.','Cum dicat putant ne. https://example.com[Famous Person Website]']
268274
____
269275
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
270276
Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna.

0 commit comments

Comments
 (0)