Bringing in more from trac-wiki.el.
Just punted and copied most of trac-wiki.el.