rtomayko / shocco

shocco is a quick-and-dirty, literate-programming-style documentation generator for / in POSIX shell
http://rtomayko.github.com/shocco/
Other
202 stars 38 forks source link

Properly order output when code0000 is empty #14

Closed rcrowley closed 12 years ago

rcrowley commented 12 years ago

I spent a good bit of time learning this code trying to get http://rcrowley.github.com/mustache.sh/mustache.sh.html to line up appropriately. Out-of-the-box it was putting the set -e line of code with the "File descriptor 3..." comment and continued off-by-one to the end.

The issue is that csplit ends up creating an empty code0000 file in many cases, which, after much experimentation, just needs to signal shocco to reverse its reversed sort order, which is what this patch does.

It's been tested against a couple of my projects plus shocco.sh itself, where the problem was and no longer is exhibited.

rtomayko commented 12 years ago

Ha. Cool. I thought csplit was the greatest idea ever but it definitely has some strange edge case behavior that keeps biting us. Thanks for running this down.