amyreese / markdown-pp

Preprocessor for Markdown files to generate a table of contents and other documentation needs
MIT License
309 stars 68 forks source link

Add support for globbing to INCLUDE (Pull request 59) breaks recursive includes with relative paths #62

Closed Frank-Krick closed 5 years ago

Frank-Krick commented 6 years ago

The change to include globbing breaks relative paths with recursive includes. The current directory has to be added in the method include not in the method include_file otherwise glob.glob does not find anything and the line will be replaced with an empty array which leads to index out of bound access later.

Additionally, currently, empty globs create list index out of bounds errors during execution. This happens because calling include returns an empty list in that case, therefore removing a line in the file that the code afterwards assumes still exists.