Ugly quotes… how beautiful they are…

I think I had already filed a bug about this on the WordPress Trac… but it wasn’t until today that I found the solution for placing JavaScript inside a WordPress post! And I owe it all to Matt Fletcher’s plugin “Strip Smart Quotes“.

His plugin replaces the ‘prettified’ HTML equivalents of single and double ‘ugly’ quotes. These equivalents break all functionality for any javascript code you would like to run in a post.

I’m also going to see if I can use manual breaks (<br />), instead of having the WordPress engine wrap paragraph elements around everything.

I added the 8243 (another ‘pretty’ double quote) to the array and 8230 (the ‘prettified’, single-character equivalent of ‘…’).

&#8216;, &#8217; and &prime; are the equivalents of ‘.
&#8221;, &#8220;, &#8243;, &Prime; are the equivalents of “.
… is the equivalent of …

Too bad about the automatic placing of breaks… that means I can’t have any manual breaks when writing scripts. Let’s see what I can do. I’ll try placing a Freemind Mindmap… like I explained in this post to the Freemind FAQ about Java Applets in XHTML.

I’ll just create a ‘div’ called ‘placetexthere’… and see if I can append it an paragraph… basic stuff. Here is a transcript of the code, and following the transcript, there should be a line that says ‘If you can read this, you are standing too close.’.

<div id="placetexthere"></div>
<div id="scriptcontainer"><script type="text/javascript">var theparagraph = document.createElement("p"); var bold = document.createElement("strong"); var thetext = document.createTextNode("If you can read this, you are standing too close."); bold.appendChild(thetext); theparagraph.appendChild(bold); var thetarget = document.getElementById("placetexthere"); thetarget.appendChild(theparagraph);</script></div>

This should work fine… if it doesn’t, I guess it should work fine from a script file. Which I’m too lazy to write right now…

One Comment

  • Hi. Thanks for the mention. I’m working on 2.1 compatibility at the moment, so I’ll let you know when it’s ready!

Post a Comment

Your email is never shared. Required fields are marked *