dive into mark

You are here: dive into markArchivesAugust 2002Automatic curly apostrophes in Movable Type

Tuesday, August 13, 2002

Automatic curly apostrophes in Movable Type

I am now using Brad Choate’s amazing MT-Regex plugin to automatically turn my straight apostrophes curly. To do it, first install the plugin, then create a new template module called curlyquotes that contains this code:

<MTAddRegex name="apos1">s/'([dmst])([ .,?!\)\/<])/&#8217;$1$2/gi</MTAddRegex>
<MTAddRegex name=”apos2″>s/’([lrv])([el])([ .,?!\)\/<])/&#8217;$1$2$3/gi</MTAddRegex>

Then, in each of your templates, add this at the top:

<$MTInclude module="curlyquotes"$>

And anywhere you have this:

<$MTEntryBody$>

Change it to this:

<$MTEntryBody regex="1"$>

Apostrophes can be typed straight, and will show up straight when editing, but they will be published as curly.

Filed under , , ,

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



Recent Stuff For You, Special Price Stay Here
  • Greasemonkey Hacks
Good Stuff Buy The Cow Go Away
Dive Into Python
Powered by Google Drink The Milk Don't Steal

 

posts / comments
© 2001-8 Mark Pilgrim