added doc/gen.js that generates ApiReference page in wiki + some other doc improvements