MAINT: f2py: rewrite fortran_doc

This fixes part of #5044. Don't wait for me to fix the whole thing.
Done.