Problems with Mephisto and Passenger

Posted by david
on 22 Mar 2009 at 15:27

My previous post contained multiple code fragments contained in macro:code blocks, but they were not formatted correctly. There was an excessive amount of space at the beginning of each code block and a smaller amount of excess space at the end, as well as extra lines between each line of code.

Looking at the source code revealed that every line of the code block was terminated with a BR tag. The XHTML code for the line number columns looked like this:

1
2
3
4
5
6
7
<pre>1<tt><br />
</tt>2<tt><br />
</tt>3<tt><br />
</tt>4<tt><br />
</tt><strong>5</strong><tt><br />
</tt>6<tt><br />
</tt></pre>

Clearly, not what is expected.

I tried the same post in a mephisto development environment but could not replicate the problem. After ruling out browser and OS differences, it was clear that the problem was confined to the production server.

Another curiosity was that the problem only happened when there were multiple code snippets or text followed a code snippet. If only one code snippet appeared in a post and nothing followed it, the BR tags were not inserted.

The differences between the development and production systems are the web server (mongrel in development and Apache + Phusion Passenger in production) and the Ruby interpreter (plain ruby in development and Ruby Enterprise Edition in production).

I quickly narrowed the problem down to Passenger. Passenger 2.1.2 was recently released but the production server was still running version 2.0.6. A quick sudo gem update passenger, an edit of the Apache config, and a restart of Apache, and the extra BR tags have been eliminated.

I can’t tell from the Passenger release notes what might have caused the problem in the first place but, whatever it was, it affected the CodeRay parsing and is no longer an issue.

Now if I can only sort out the CSS issues that are causing some minor formatting glitches with the code snippets in Opera and Firefox 2.

Comments

Sorry, comments are closed.