Skip to content

Commit

Permalink
resolves #22 support sidebar blocks (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Sep 18, 2023
1 parent 02ba7e3 commit 9b90f73
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class JupyterConverter {
}
return cells
}
if (nodeName === 'example') {
if (nodeName === 'example' || nodeName === 'sidebar') {
const blocks = node.getBlocks()
const cells = []
let lastCell = {}
Expand Down
22 changes: 21 additions & 1 deletion test/converter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,32 @@ He could hear doves **cooing** in the pine trees’ branches.
to_file: false
})
expect(result).is.not.empty()
debug()
const ipynb = JSON.parse(result)
expect(ipynb.cells[0].source.join('')).is.equal(`[Refcard](refcard.pdf)
[[sect-a]](#sect-a)
`)
await debug(result, 'xrefs.ipynb')
})
it('should convert nested blocks', async () => {
const inputFile = path.join(__dirname, 'fixtures', 'nested-blocks.adoc')
const result = asciidoctor.convertFile(inputFile, {
safe: 'safe',
backend: 'jupyter',
to_file: false
})
expect(result).is.not.empty()
const ipynb = JSON.parse(result)
expect(ipynb.cells[0].source.join('')).is.equal(`# Nested Blocks
*Title*\\
Example…​
$$
A_1=\\left(\\begin{array}{lll}
$$
`)
await debug(result, 'nested-blocks.ipynb')
})
})
11 changes: 11 additions & 0 deletions test/fixtures/nested-blocks.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
= Nested Blocks

.Title
[.style]
****
Example...
[stem]
++++
A_1=\left(\begin{array}{lll}
++++
****

0 comments on commit 9b90f73

Please sign in to comment.