Bug with code blocks (containing tab?)
aubertc opened this issue · comments
The following markdown file:
```
test
```
when compiled with
pandoc --filter pandoc-include test.md -o test.html
returns
Traceback (most recent call last):
File "~/.local/bin/pandoc-include", line 8, in <module>
sys.exit(main())
File "~/.local/lib/python3.7/site-packages/pandoc_include/main.py", line 380, in main
return pf.run_filter(action, doc=doc)
File "~/.local/lib/python3.7/site-packages/panflute/io.py", line 224, in run_filter
return run_filters([action], *args, **kwargs)
File "~/.local/lib/python3.7/site-packages/panflute/io.py", line 205, in run_filters
doc = doc.walk(action, doc)
File "~/.local/lib/python3.7/site-packages/panflute/base.py", line 264, in walk
ans = list(chain.from_iterable(ans))
File "~/.local/lib/python3.7/site-packages/panflute/base.py", line 262, in <genexpr>
ans = ((item,) if type(item) != list else item for item in ans)
File "~/.local/lib/python3.7/site-packages/panflute/base.py", line 259, in <genexpr>
ans = (item.walk(action, doc) for item in obj)
File "~/.local/lib/python3.7/site-packages/panflute/base.py", line 275, in walk
altered = action(self, doc)
File "~/.local/lib/python3.7/site-packages/pandoc_include/main.py", line 363, in action
includeType, name, config = is_code_include(elem)
File "~/.local/lib/python3.7/site-packages/pandoc_include/main.py", line 98, in is_code_include
value, name, config = is_include_line(new_elem)
File "~/.local/lib/python3.7/site-packages/pandoc_include/main.py", line 67, in is_include_line
if (len(elem.content) not in [3, 4]) \
File "~/.local/lib/python3.7/site-packages/panflute/base.py", line 106, in content
return self._content
AttributeError: 'CodeBlock' object has no attribute '_content'
Error running filter pandoc-include:
Filter returned error status 1
Note that the file does not perform any actual inclusion and compile just fine without the filter.
Another weird bug is produced by
```
<script>
```
I'm not sure if this related better to this issue or to #24 (which may have the same root...), but the error message is now
AttributeError: 'RawBlock' object has no attribute '_content'
1436483 fixes it.