Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

January 12, 2007

MTValidate 0.5

In my quest to improve the user experience hereabouts, I decided to convert this MovableType installation to FastCGI. I’ll explain what’s involved in that in another post, but I did run into a nasty stumbling block: the MTValidate plugin, that we rely on heavily, was incompatible with FastCGI.

It was not (at first) apparent why MTValidate was failing in a FastCGI environment; there were lots of crufty bits of W3C Validator code, which I thought might be the culprits. So I engaged in a lot of code clean-up until I eventually figured out that the problem was its use of IPC::Open3, which is not compatible with FastCGI.

Once I knew what the problem was, it was easy to fix (as written, there was no good reason for the W3C Validator code to be using IPC::Open3 in the first place). But, along the way, I found that I had

  • Cleaned up the code considerably.
  • Trimmed the prerequisites a little further.
  • Made it an MT-3.x-aware plugin.

Time to release a new version.

Posted by distler at January 12, 2007 11:15 PM

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/1105

9 Comments & 1 Trackback

Re: MTValidate 0.5

thanks for new version :)

Posted by: Chip Martins on January 13, 2007 3:51 PM | Permalink | Reply to this

Re: MTValidate 0.5

Thanks for doing that. I tried FastCGI last month and found the problem with MTValidate but didn’t have time to investigate.

Posted by: Zack on January 14, 2007 11:34 PM | Permalink | PGP Sig | Reply to this

Re: MTValidate 0.5

Has anyone tried to use MTValidate to validate new entries in addition to comments? I’m assuming this would require either hacking the MT source or a version of MTValidate as a back-end plugin for the New Entry screen. How difficult would this be to accomplish?

Thank you in advance for any feedback.

Posted by: boblet on March 1, 2007 11:14 PM | Permalink | Reply to this

Validating Entries

We do precisely that on the blogs I host here on Golem.

Just as with comments, when you preview an entry, it gets run through the Validator.

Posted by: Jacques Distler on March 2, 2007 12:37 AM | Permalink | PGP Sig | Reply to this

Re: Validating Entries

Thank you for your reply Jacques. I was hoping you were going to say that!

Is there any chance you could explain how you did so? (you knew that was coming didn’t you :-)

Posted by: boblet on March 2, 2007 5:51 AM | Permalink | Reply to this

Re: Validating Entries

Yes, I know that was coming.

When I originally did this, the only way to do it was to modify the Application itself, since the template for the entry-preview page was embedded in the application.

Specifically, it’s in lib/MT/App/CMS.pm around line 7495. If you look at my omnibus patch file, for MT 3.3x, you can see exactly what I did and where I did it. I added the line

$ctx->stash('blog_id', $blog_id);

at line 7499 and then replaced

<p><b><$MTEntryTitle$></b></p>
<$MTEntryBody$>
<$MTEntryMore$>

with

<MTValidate>
<$MTInclude module="DTD"$>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your Comment</title>
</head>
<body>
<h3 class="title"><$MTEntryTitle smarty_pants="2"$></h3>
<div>
<$MTEntryBody smarty_pants="2"$>
<hr />
<$MTEntryMore smarty_pants="2"$>
</div>
</body>
</html>
</MTValidate>
<MTValidateIfValid> <h3 class="title"><$MTEntryTitle smarty_pants="2"$></h3> <div> <$MTEntryBody smarty_pants="2"$> <hr /> <$MTEntryMore smarty_pants="2"$> </div> </MTValidateIfValid>

Nowadays, I believe it is possible for a plugin to customize the template code for the entry preview page. But I have never gotten around to revisiting this bit of code and seeing whether I can replace it by a plugin.

Posted by: Jacques Distler on March 2, 2007 8:00 AM | Permalink | PGP Sig | Reply to this

Re: Validating Entries

Thanks for the directions - I’d downloaded the patch but had yet to look at it. If you ever revisit it and decide to make a plugin/extend MTValidate, I’d love to hear about it!

To tell the truth I’m a little surprised there still don’t seem to be any blog/CMS tools that do this by default. Shouldn’t it be easier than this?

Posted by: boblet on March 3, 2007 8:38 AM | Permalink | Reply to this

This should be…

To tell the truth I’m a little surprised there still don’t seem to be any blog/CMS tools that do this by default.

So am I. Especially, since I’ve been beating the drum about this for 4 years.

Shouldn’t it be easier than this?

See the Wiki software I’m working on. Reliably well-formed XHTML(+MathML+SVG) output, whatever the user happens to type.

If you want something done right …

Posted by: Jacques Distler on March 3, 2007 9:27 AM | Permalink | PGP Sig | Reply to this

Re: This should be…

If you want something done right …

Great! All I have to do now is learn to program - should be easy to whip up a CMS that understands internationalization and does standards too!!

Sigh.

Posted by: boblet on March 9, 2007 3:37 AM | Permalink | Reply to this
Read the post Commenting Problems
Weblog: Procrastination
Excerpt: Commenting using non-ASCII characters is not working right now. We hope to have a fix soon. Temporary fix is to revert a recent upgrade of the MTValidate plugin.
Tracked: March 6, 2007 6:29 PM

Post a New Comment