Separate patching logic for haddock files