Move inpage anchor generator to util functions
Fix correct extranction of extension when using anchor links

* As presented in pull request #22 by tollus