a minor error in code
Opened this issue · 2 comments
in chapterize.py line 173
endLocation = len(self.lines)-1 # The end
I think it's better set as len(self.lines)
because if we can't detect the end location, the last line could possibly be part of the book and shouldn't be removed.
To be honest, I don't really remember why I wrote it like that. It could very well be a mistake. If you'd like to submit a pull request, and test it against a few texts to make sure it works, I'd be happy to review it.
Hey, Sailors! Just a tip.
I removed the -1 from line 173 -> [ endLocation = len(self.lines)-1 ] and i got an error of index out of range.
Then, i applied again the -1 and it flowed like a charm! In summary, guys don't remove the -1, or the index error will pop over line 16 -> [headingsPlain = [self.lines[loc] for loc in self.headingLocations] ]