The World Through the Eyes of John Brennan
This will be a short post. I just installed Ryan McGeary’s WP-syntax plugin for Wordpress. Let’s see a few examples…
<body> <?php echo $javascript->link('prototype_1.6.0'); echo $javascript->link('scriptaculous_1.8.0/scriptaculous'); echo $javascript->link('home'); echo $scripts_for_layout; ?> </body>
1 2 3 4 5 | class Example def example(arg1) return "Hello: " + arg1.to_s end end |
That looks pretty good. I did find a bug when using this plugin with WP 2.3.3. When I go back to edit the post some of the code tags are converted to html entities. The format is also not preserved (spacing and newlines). I should note that the WP-syntax plugin only says it is compatible with WP up to 2.2.2, so my version (which WP has actually released another update for) isn’t technically supported yet. Ryan got back to me (see comment below) that the plugin does in fact work with WP 2.3.3 (as well as 2.5 too).
I also noticed a funky bug that occurs when I toggle between visual and code view in the WP editor. It seems as though the javascript is tinkering with it. I’ll try to investigate and do a follow post on that another time.
Update: I really wanted to avoid modifying the core WP files because it would be a pain when I wanted to upgrade again. I decided to upgrade to WP 2.5 and see what I can do. As it turns out, ver 2.5 remembers the last editor you were using. In my case it happens to be HTML, so it brings that up initially. The code text isn’t modified and everything is great! Note: I could’ve also turned off the visual editor, but then I wouldn’t have that editor for other posts and I didn’t want to impose that limit on myself.
Code. Design. Explore. is the blog of John Brennan, a web developer/designer, entrepreneur, and avid world traveler. I currently live in San Diego, CA, USA.
My first passion is to create. I want to be part of a successful startup that will empower others. I believe in designing for the user and appreciate other web apps that design for usability.
My second passion is to help. My heart lies in philanthropy and helping others that are just as able, but haven't been afforded the same opportunities only because they were born at a different coordinate on this Earth.
This blog will mostly be around building cool things, although I will surely include my travel experiences when I am abroad. Feel free to subscribe to a specific category if that is only what interests you. And please connect with me. I always enjoy meeting new, interesting people!
Ryan McGeary
April 4th, 2008 at 1:37 pm
John, Hi. The WP editor bastardizes the source. It’s highly recommended that you run without the visual editor. Personally, I use textile, so this isn’t an issue for me, but I realize it’s a pain for some.
Also, WP-Syntax is compatible with 2.3.x as long as you avoid the visual editor. I just haven’t updated the “official” compatibility note. I usually only do that on version upgrades, so that explains why it lags behind a bit.