Only trim known extensions from page name

Previously any extension on the file was trimmed, but this could give
confusing results.  Now RDoc only trims rb, rdoc, txt and md extensions.

Fixes ruby bug #7673