chapterize icon indicating copy to clipboard operation
chapterize copied to clipboard

a minor error in code

Open eveliao opened this issue 7 years ago • 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.

eveliao avatar Aug 05 '18 14:08 eveliao

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.

JonathanReeve avatar Aug 06 '18 02:08 JonathanReeve

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] ]

Ingrid-0906 avatar Nov 08 '23 20:11 Ingrid-0906