Well, I think [;-)] I finally got all the kinks worked out of the combination of Textile + Beautifier + WordPress’s character replacement… I had to fix a regular expression or two in WordPress (they were actually wrong, it wasn’t just me, tweaking), and re-order a few lines of Textile code, and then force Textile (at mouse-point) to leave the stuff inside < code> blocks alone. And then, force Textile to leave the stuff inside < code> blocks alone again. ;)

The bad news is, I’m not sure I can keep track of the changes I made to b2functions.php so I can make them again after my next upgrade [:-/]

So now the problems is, since I’ve got it working, I feel like I need to show it off by posting some code here, but the only code I can think of at the moment is the code for Textile … (I’m not allowed to post the code (yet?) to my solution for my school project).

So, here’s the mungy line I had to add to the bottom of Textile’s untextile($text) method:


return ( function_exists( 'mb_decode_numericentity' ) )
   ?  decode_high( $text )
   :  ( ( function_exists( 'html_entity_decode' ) )
      ?  html_entity_decode( $text );
      :  strtr( $text, array_flip( get_html_translation_table( HTML_ENTITIES ) ) ) );

 

It’s pretty horrid, but it should work on versions of PHP back to PHP3 with varying degrees of success. That is, it works fine, even on old PHP, but it works a lot better if you have 4.3 or newer, and even better if you have multi-byte strings enabled. [:-P]