Skip to content

Commit 9b90f73

Browse files
authored
resolves #22 support sidebar blocks (#23)
1 parent 02ba7e3 commit 9b90f73

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class JupyterConverter {
104104
}
105105
return cells
106106
}
107-
if (nodeName === 'example') {
107+
if (nodeName === 'example' || nodeName === 'sidebar') {
108108
const blocks = node.getBlocks()
109109
const cells = []
110110
let lastCell = {}

test/converter.spec.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,32 @@ He could hear doves **cooing** in the pine trees’ branches.
360360
to_file: false
361361
})
362362
expect(result).is.not.empty()
363-
debug()
364363
const ipynb = JSON.parse(result)
365364
expect(ipynb.cells[0].source.join('')).is.equal(`[Refcard](refcard.pdf)
366365
367366
[[sect-a]](#sect-a)
368367
`)
369368
await debug(result, 'xrefs.ipynb')
370369
})
370+
it('should convert nested blocks', async () => {
371+
const inputFile = path.join(__dirname, 'fixtures', 'nested-blocks.adoc')
372+
const result = asciidoctor.convertFile(inputFile, {
373+
safe: 'safe',
374+
backend: 'jupyter',
375+
to_file: false
376+
})
377+
expect(result).is.not.empty()
378+
const ipynb = JSON.parse(result)
379+
expect(ipynb.cells[0].source.join('')).is.equal(`# Nested Blocks
380+
381+
*Title*\\
382+
Example…​
383+
384+
385+
$$
386+
A_1=\\left(\\begin{array}{lll}
387+
$$
388+
`)
389+
await debug(result, 'nested-blocks.ipynb')
390+
})
371391
})

test/fixtures/nested-blocks.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
= Nested Blocks
2+
3+
.Title
4+
[.style]
5+
****
6+
Example...
7+
[stem]
8+
++++
9+
A_1=\left(\begin{array}{lll}
10+
++++
11+
****

0 commit comments

Comments
 (0)