RF: refactor API generation for generality

Make the apidoc and template generation a little more generic for
sharing between projects.
NF: .gitignore generated reference directory