diff --git a/src/index.js b/src/index.js index 9972b01..ea37ea8 100644 --- a/src/index.js +++ b/src/index.js @@ -104,7 +104,7 @@ class JupyterConverter { } return cells } - if (nodeName === 'example') { + if (nodeName === 'example' || nodeName === 'sidebar') { const blocks = node.getBlocks() const cells = [] let lastCell = {} diff --git a/test/converter.spec.js b/test/converter.spec.js index 6b39ada..613705c 100644 --- a/test/converter.spec.js +++ b/test/converter.spec.js @@ -360,7 +360,6 @@ 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) @@ -368,4 +367,25 @@ He could hear doves **cooing** in the pine trees’ branches. `) 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') + }) }) diff --git a/test/fixtures/nested-blocks.adoc b/test/fixtures/nested-blocks.adoc new file mode 100644 index 0000000..ec52fda --- /dev/null +++ b/test/fixtures/nested-blocks.adoc @@ -0,0 +1,11 @@ += Nested Blocks + +.Title +[.style] +**** +Example... +[stem] +++++ +A_1=\left(\begin{array}{lll} +++++ +****