Do not mutate parameters passed in from the outside

wiki.write_page mutates the name and the dir parameters passed in from the outside through `gsub!`. This can have unexpected (and hard to track down) results if you hang on to that variable for some reason or if you assert on its value.

Replaced it with gsub and added a test.