discourse/discourse — pull request #684 by ZogStriP (2013-04-10 02:33:43+00:00)
Title: auto replace rules in titles

Meta: [Should we have auto-replace rules in titles?](http://meta.discourse.org/t/should-we-have-auto-replace-rules-in-titles/5687)

This pull requests provides some new `site settings` that allows the administrator to enable the following auto-replace rules in titles:
- [x] Replace ???? with a single ?
- [x] Replace !!!!! with a single !
- [x] Replace all-caps titles with regular case letters
- [x] Capitalize first letter in the title
- [x] Remove an unnecessary period at the end of the title
- [x] Remove the extraneous space before the end punctuation *(for `en` only)*

(All are disabled by default)

Here's what I've done:
- [x] I've *extracted* the **cleaning** responsability from `TextSentinel` and integrated it in the new `TextCleaner`
- [x] I refactored a bit where the code where `TextSentinel` was called.
- [x] I updated the styles on the Site Setting admin page to leave enough room for the new settings (which are quite long)
- [x] I've updated the `topics_controller` to serialize the title back to the client when an update is done to the topic
- [x] I've updated the `topic_view` so that it takes into account any title modifications made server-side (when you edit the title of the topic using the pencil *button*)