Rewrite generateDoc script