properly escape backslashes in class and method directives
minor #3937 properly escape backslashes in class and method directives (xabbuh)

This PR was merged into the 2.5 branch.

Discussion
----------

properly escape backslashes in class and method directives

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.5+
| Fixed tickets |

Commits
-------

6c4421b properly escape backslashes in class and method directives