## June 3, 2004

### itexToMML News

A minor update to my MovableType itexToMML plugin. With this update, the itex to MathML with parbreaks filter is much smarter about skipping over block-level tags. There’s no change to the itex2MML executable, which was last updated at the end of April.

If you’ve tried commenting on this blog, you’ll also have noticed that I have Textile with itex to MathML and Markdown with itex to MathML filters available. If you have Textile 1.1 and/or Markdown 1.0 installed on your system, you can get the same functionality on your blog by

1. Applying this patch to Textile and/or this patch to Markdown.
2. Installing the TextileMarkdownMML plugin.

(Anyone who wants to take a crack at getting this to work with Textile 2.x is welcome to try.)

Finally, a minor update to my WordPress patch, which enable my WordPress plugin to work nicely with the existing WordPress text filters (wptexturize, Textile1, Textile2 and Markdown). For those who’ve already applied my previous patch, the new bit is

--- wp-includes/functions-formatting.php.orig   Sun May 16 17:14:14 2004
+++ wp-includes/functions-formatting.php        Thu May 20 12:27:40 2004
@@ -103,7 +104,7 @@
$content = preg_replace('/<category>(.+?)<\/category>/','',$content);
// Converts lone & characters into &#38; (a.k.a. &amp;) - $content = preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $content); +$content = preg_replace('/&([^#])(?![a-z]+;)/i', '&#038;$1',$content);
// Fix Word pasting $content = strtr($content, \$wp_htmltranswinuni);

Update (8/25/2004): Updated for Markdown 1.0.

Posted by distler at June 3, 2004 12:43 PM

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

### WordPress

What are the mean reasons not to switch? Since it seems you got most of MathML enabled already, not?

The only difficult part is that you would probably have to add namespace support to the current comment validator few people are using. And perhaps you could add those namespaces yourself, based on the element name, although I think that would be considered harmful…

Posted by: Anne on June 3, 2004 1:20 PM | Permalink | Reply to this

### Re: WordPress

This barely scratches the surface of what is required.

The itexToMML plugin brings to WordPress the functionality that MovableType got back in February, 2003. Or it would do so, were it not for a serious bug in WordPress, which currently renders the plugin nearly useless.

Matt is, even as we speak, hard at work, attempting to fix the bug. For the sake of discussion, let’s assume he’s succeeded. Will that be enough?

Not hardly. Technology does not stand still. Here’s my top-ten list of features I would still need in WordPress.

1. Comment previews.
2. Text filters which are selectable on a per-post and per-comment basis.
4. Validation for entries and for comments. And, no
• I’m not going to hack namespace support into the validator you and some others are using.
• An error message which says “Your XHTML is not well-formed.” without a source-listing and a link to the line in the source where the error occurred is not acceptable. The W3C validator (which is what I use now) may not be super user-friendly, but it is way better than anything else I’ve seen.
5. Support for PGP-signed comments. (Yes, I know there’s a plugin under development. But it doesn’t actually work yet.)
6. Multi-blog support. It’s enough work keeping one highly-customized installation up-to-date. Having separate installations for every blog I host is too much.
7. Plugins for feed syndication and Technorati Cosmos, as appear on my sidebar.
8. Throttling of comments/trackbacks/pingbacks. I’ve seen what happens when a WordPress blog gets crapflooded. It ain’t pretty. Moderation is not an adequate substitute, as you still have to clean up thousands of bogus items in your database. It’s even worse if you have a comparable number of email notifications in your inbox to deal with.
9. A better Search facility. MT’s search facility is feature-rich, if resource-intensive. I’ve wanted to redo it using SQL queries and the full-text search capability of recent versions of MySQL. Something reasonably good would be desirable for WordPress.
10. Robust static caching of pages. Golem is my desktop machine, and I’m not going to have it waste CPU cycles creating pages on-the-fly for every HTTP request. I still get a laugh when new WordPress users boast about how marvelously fast it is, when in fact, their blogs are dog-slow. (One fellow’s sidebar would take a full minute to appear and it would keep taking a minute to appear on every page of his blog.)

I realize that some of these things have been hacked into WordPress by various people. I would like something that’s either incorporated into the stock distribution, or available as a plugin. I’m not eager to spend an inordinate amount of time hacking WordPress. (The time I spent hacking MT is a sunken cost. And, since I don’t know PHP, I’m not exactly in a position to do any serious hacking on WP myself.)

Six months, or a year from now, the situation may have changed. But right now, switching is not feasible.

Posted by: Jacques Distler on June 3, 2004 4:39 PM | Permalink | PGP Sig | Reply to this

### Re: WordPress

That’s a very nice list. Doesn’t quite parallel mine (I don’t have your need to store things other than XHTML, so my only interest in filters is that they be required to round-trip, and only store XHTML), but it’s awfully close.

But I want it on refrigerator magnets, so I can drag it around into various orders: most to least hackable, most to least survivable (since my crappy host has had MySQL outages at least five times that I’ve noticed since the start of the MT exodus, caching isn’t just performance for me, it’s a matter of being able to show something other than just an error message).

I think you might be surprised how small a barrier not knowing PHP really is, though. Compared to Perl, it’s dead simple, and where Perl has a little totally incomprehensible documentation, PHP has a wonderful manual. It can be frustrating, since there’s either one or zero ways to do it, but it’s quick and easy to learn.

Posted by: Phil Ringnalda on June 4, 2004 12:56 AM | Permalink | PGP Sig | Reply to this

### PHP

Yeah, I know it’s pretty easy to learn. I did, after all, learn enough to write a plugin for WordPress, and contribute some patches to the source code.

But to do more (in particular, to implement this checklist myself) would require actually sitting down and learning PHP (and the structure of the WordPress source code) in detail.

Having stared a bit at the WordPress source code, in the hopes of fixing the backslash bug, I do not feel particularly sanguine about my abilities in this regard.

And since time is money, and all of this already works in MovableType, …

Posted by: Jacques Distler on June 4, 2004 1:23 AM | Permalink | PGP Sig | Reply to this

### Re: WP-PHP

Ah, well, that would be one of the toughest ways to learn PHP ;)

You’ve got three choices with backslashes: try to consistently deal with them at the edges, as soon as you get input, which is what they’ve tried to do and failed; tell people that they need to set up PHP correctly on their machine to have things work (which requires at least .htaccess), or deal with them centrally, as part of saving, and only be careful with input that isn’t saved (like rejected comments). The last one seems the most likely to work, but any one of them will require a total refactoring, plus some database massaging, since WP has been merrily saving slashes in the db, rather than just putting in one set that MySQL will then remove. It’s a really ugly problem.

And, as you say, you don’t have to switch.

Posted by: Phil Ringnalda on June 4, 2004 2:02 AM | Permalink | PGP Sig | Reply to this

### Re: WordPress

Although I think that hacking PHP isn’t really difficult when you already have knowledge of Perl people could help you with hacking, right?

1 and 6 and 9 are already possible. I have a simple version of 9 already running on my weblog, but it still needs some extra work (I am using FULLTEXT from MySQL).

6 is almost a complete hack at the moment, which I’m not using on my weblog but I’m working on a project which does have multiple weblogs running on a single WP installation.

I thought I had seen 3 somewere as well. And 10 might be possible using funky caching.

I was wondering, how do text filters work? Do they translate the text into XHTML+MathML and enter it into the database?

4 needs some extra then, but even that shouldn’t be that hard.

Posted by: Anne on June 4, 2004 1:12 AM | Permalink | Reply to this

### Re: WordPress

I was wondering, how do text filters work? Do they translate the text into XHTML+MathML and enter it into the database?

Text filters for WordPress work a lot like text filters for comments in the “stock” version of MovableType. You select a filter in the administrative interface, and it applies to all comments on your blog. In the case of WordPress, it applies to all your posts as well.

MovableType adds the ability to apply different filters to each post. The choice of filter to apply to each post is stored in the database, as another field associated to the post. I added the ability to apply different filters to each comment.

The comments and posts are stored in the database in the form in which they were originally entered, for ease of later editing. They are converted to XHTML (+MathML, in my case) when the page is created. In the case of WordPress, that means, each time the page is accessed.

Posted by: Jacques Distler on June 4, 2004 1:39 AM | Permalink | PGP Sig | Reply to this

### Re: WordPress

Thanks for the explanation on text filters. About validating, there are actually some PHP DTD processors so that might be possible without too much hassle.

Caching of pages is possible as well, but I think you want to wait a little while until you need to hack WordPress less to add functionality.

Posted by: Anne on June 5, 2004 5:08 AM | Permalink | Reply to this

### Maybe later

…but I think you want to wait a little while until you need to hack WordPress less to add functionality.

That was my thought, too :-).

But, right now, the backslash bug is a total showstopper. If you want some fun, try the following itex equation in WordPress with my plugin installed:

$\left(\array{a&b\\c&d}\right)$

which should yield the matrix

(1)$\left(\array{a&b\\ c&d}\right)$

If you got that to work the first time, try editing the post/comment. Boom! Not so pretty, huh?

Posted by: Jacques Distler on June 5, 2004 10:08 AM | Permalink | PGP Sig | Reply to this
Read the post The sum of all things
Weblog: Upon Reflection
Excerpt: One of the reasons I started this weblog in the first place was to discuss topics in mathematics and physics. Inevitably, this means I need some way to write mathematics in a weblog. There are two basic ways to...
Tracked: June 4, 2004 2:53 PM
Read the post The sum of all things
Weblog: Upon Reflection
Excerpt: One of the reasons I started this weblog in the first place was to discuss topics in mathematics and physics. Inevitably, this means I need some way to write mathematics in a weblog. There are two basic ways to...
Tracked: December 16, 2004 11:46 PM

### Re: itexToMML News

For PHP5 Users, it the function can not be the same with the class
so, the “itexToMML” method in the class “itexToMML” should be rename like “itexCovMML”

Posted by: Inferno on September 25, 2007 8:12 AM | Permalink | Reply to this

### Re: itexToMML News

I have tested this under PHP 5.2.4 and I have no idea what you are talking about.

But, since you are a spammer, I assume there’s no reason for your comments to actually make sense.

Posted by: Jacques Distler on September 25, 2007 8:44 AM | Permalink | PGP Sig | Reply to this

Post a New Comment