Factorize __apidoc__ handling