hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
310 stars 60 forks source link

Comment #idx{with text here} before tex environment crashes when compiling to notebook #103

Open simetenn opened 7 years ago

simetenn commented 7 years ago

Doconce does something unexpected with comments. In the following cases a commented idx command crashes Doconce when trying to convert to a notebook.

# This example does not fail
!bt
tex here
!et

# idx{with text here this example fails}
!bt
tex here
!et

# idx{This works}

!bt
tex here
!et

idx{this works}
!bt
tex here
!et

This works
# idx{}
!bt
tex here
!et

# idx{with text here this example fails}
!bc
tex here
!ec

The error message is:

Traceback (most recent call last):
  File "/home/simen/src/anaconda3/envs/doconce/bin/doconce", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/simen/phd/projects/doconce/bin/doconce", line 1721, in <module>
    bg_session = main()
  File "/home/simen/phd/projects/doconce/bin/doconce", line 1710, in main
    retval = eval(command + '()')
  File "<string>", line 1, in <module>
  File "/home/simen/phd/projects/doconce/bin/doconce", line 103, in format
    bg_session = doconce.doconce.format_driver()
  File "/home/simen/phd/projects/doconce/lib/doconce/doconce.py", line 5326, in format_driver
    out_filename, bg_session = file2file(filename_preprocessed, format, basename)
  File "/home/simen/phd/projects/doconce/lib/doconce/doconce.py", line 4173, in file2file
    filestr, bg_session = doconce2format(filestr, format)
  File "/home/simen/phd/projects/doconce/lib/doconce/doconce.py", line 4665, in doconce2format
    tex_blocks, format)
  File "/home/simen/phd/projects/doconce/lib/doconce/ipynb.py", line 569, in ipynb_code
    n = int(words[0])
ValueError: invalid literal for int() with base 10: '<!--'