Fixes https://gitlab.gnome.org/GNOME/gtk-doc/issues/84 which was breaking the documentation build for glib. The patch was based off an upstream pr [0] but completed with the requested changes. [0]: https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/27