doc build-related fixes
Created originally on Bitbucket by frantony (Antony Pavlov)
Was already merged in Bitbucket before import, marked as merged by the import user
Source changeset not longer availableat the time of import. Commit listwill look empty
There is no error checking during 'make docs'. This pull request partly fixes the problem.
Also some doc/mkdoc*.py factorization is made.