Implemented internal page linking.

Any links starting with `#/` will be looked up by virtual path.

Fixes bug 2829.
Minimum Django version is 1.4.
Fix style and conditions