4.0.3 Textile fix
Well, it's that time again. My favorite CMS, Textpattern has been updated to version 4.0.3, so I'm busy re-hacking things back to my liking. One of my pet peeves as of version 4.0.2 is that full Textile is now enabled for comments. While this is all well and good for the most part, it means that there are inconsistencies in formatting between previous and latter versions of TXP.
So, for sites like mine, that has been running TXP ever since RC1(Release Candidate 1), there is quite a lengthy history of comments. To switch over to the new format now would mean having to go back and re-format all my old comments. This is not something I want to do. Aside from laziness, another reason the new comment formatting scheme doesn't sit well with me is anyone can insert any Textile HTML element into comments, including headers and even tables.
To remedy this problem, I have tweaked the txplib_misc.php
which is found in the /textpattern/lib/
directory. I sincerely hope that they provide for some sort of admin interface toggling option for comment handling in the future, but for now we can make-do by hacking the PHP to our liking. Here is a summary of the code changes that I've made in order to fix the formatting:
// Lines 1205 to 1210:
$msg = trim(
$textile->blockLite(
$textile->TextileThis(
strip_tags(deEntBrackets($msg)),1
),'',$im,'',(@$comment_nofollow ? 'nofollow' : ''))
);
// Replacement Code:
$msg = trim(
nl2br(
$textile->TextileThis(@
strip_tags(deEntBrackets($msg)),1,
'',$im,'',(@$comment_nofollow ? 'nofollow' : '')))
);
In case you are not comfortable hacking up your Textpattern installation, don't sweat it. I have provided a replacement PHP file, along with some brief instructions. You can download them in a neat little Zip file here…
- 403-textile-fix.zip (12 KB)
You will just need to replace this file with the old one. Though I have had no problems at all with this fix, I recommend backing up your old one, just in case. Please note, this is only for the Textpattern 4.0.3 release. If you are still running TXP 4.0.2, you will need to get the previous Textile Comments Fix.