thorstenb / odpdown

Generate OpenDocument Presentation (odp) files from markdown
Other
107 stars 18 forks source link

Empty list item causes crash #8

Closed aspiers closed 9 years ago

aspiers commented 9 years ago

E.g. if the second line in the below testcase ends in a space, then

* foo
*
* bar

causes:

Traceback (most recent call last):
  File "/home/adam/SUSE/git/odpgen/odpgenerator.py", line 810, in <module>
    main()
  File "/home/adam/SUSE/git/odpgen/odpgenerator.py", line 801, in main
    pages = mkdown.render(markdown.read())
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 927, in render
    return self.parse(text)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 930, in parse
    out = self.output(preprocessing(text))
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 972, in output
    self.tokens = self.block(text, rules)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 190, in __call__
    return self.parse(text, rules)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 209, in parse
    m = manipulate(text)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 204, in manipulate
    getattr(self, 'parse_%s' % key)(m)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 264, in parse_list_block
    self._process_list_item(cap, bull)
  File "/home/adam/SUSE/git/odpgen/mistune/mistune.py", line 291, in _process_list_item
    _next = item[len(item)-1] == '\n'
IndexError: string index out of range