aaren / notedown

Markdown <=> IPython Notebook
BSD 2-Clause "Simplified" License
855 stars 115 forks source link

--precode does not work with --match=python #53

Open stefanv opened 8 years ago

stefanv commented 8 years ago
$ notedown --match=python --precode='%matplotlib inline' lessons/0_images_are_arrays.md > book/lessons/0_images_are_arrays.ipynb
Traceback (most recent call last):
  File "/home/stefan/envs/py3/bin/notedown", line 11, in <module>
    sys.exit(app())
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/main.py", line 312, in app
    main(args, help=parser.format_help())
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/main.py", line 275, in main
    notebook = reader.read(ip, as_version=4)
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/nbformat/v4/rwbase.py", line 89, in read
    return self.reads(nbs, **kwargs)
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/notedown.py", line 376, in reads
    return self.to_notebook(s, **kwargs)
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/notedown.py", line 366, in to_notebook
    blocks = [self.process_code_block(block) for block in all_blocks]
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/notedown.py", line 366, in <listcomp>
    blocks = [self.process_code_block(block) for block in all_blocks]
  File "/home/stefan/envs/py3/lib/python3.5/site-packages/notedown/notedown.py", line 214, in process_code_block
    return self.new_text_block(content=block['raw'])
KeyError: 'raw'

$ notedown --match=python lessons/0_images_are_arrays.md > book/lessons/0_images_are_arrays.ipynb $ notedown --precode='%matplotlib inline' lessons/0_images_are_arrays.md > book/lessons/0_images_are_arrays.ipynb