You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When my included source code contained a newline I got a backtrace:
Traceback (most recent call last):
File "/usr/bin/pandoc-include", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.10/site-packages/pandoc_include/main.py", line 333, in main
return pf.run_filter(action, doc=doc)
...
File "/usr/lib/python3.10/site-packages/pandoc_include/main.py", line 309, in action
codes.append(read_file(fn, config))
File "/usr/lib/python3.10/site-packages/pandoc_include/main.py", line 160, in read_file
content = "\n".join(dedent(content, config["dedent"]))
TypeError: sequence item 4: expected str instance, NoneType found
Error running filter pandoc-include:
Filter returned error status 1
I fixed this by adding a check in removeLeadingWhitespaces():
def removeLeadingWhitespaces(s, num):
if not s.strip(): # <<< empty lines didn't work
return s
regex = re.compile(r"[^\s]")
m = regex.search(s)
if m == None:
return
pos = m.span()[0]
if num < 0:
return s[pos:]
else:
return s[min(pos, num):]
The text was updated successfully, but these errors were encountered:
When my included source code contained a newline I got a backtrace:
I fixed this by adding a check in
removeLeadingWhitespaces()
:The text was updated successfully, but these errors were encountered: