Refactor api_doc_gen

Adds significant modularity and cleanup to the old monolithic generator.

This closes #42 for now because adding a new documentation generator would significantly increase the scope of this project and I would like to keep it limited to the existing simplistic view for the time being.