Curly Quotes in Movable Type

I am happy to announce that the “curlyquotes” module for Movable Type has passed out of beta into the release stage. Many thanks to Todd of Dominey Design for testing and providing valuable feedback. Here are the updated instructions. For full details, please see this script’s info page, which lets you receive updates by email, leave comments, report bugs, ask for features, and ask questions, et cetera. Here are the updated installation directions:

  1. Install the MTRegex plugin. (Directions from readme.txt file)
    1. Get file.
    2. Place the ‘regex.pl’ file in your Movable Type “plugins” directory
    3. Place ‘regex.pm’ and ‘postproc.pm’ in a ‘bradchoate’ subdirectory underneath your Movable Type “extlib” directory.
    4. You should end up with something like this:
      • (mt home)/plugins/regex.pl
      • (mt home)/extlib/bradchoate/regex.pm
      • (mt home)/extlib/bradchoate/postproc.pm
  2. Create a new template module called curlyquotes with the code from here.
  3. Add <$MTInclude module="curlyquotes"$> to the top of all your templates.
  4. Replace all occurences of <$MTEntryBody$> with <$MTEntryBody
    regex="1"$>
    .

Usage is free, in every sense of the word, but if you could throw a link back this way I would appreciate it. Also if you improve on the code in some way, submit your changes so everyone can benefit.

What this module does: It takes straight quotes/prime mark, and makes them proper typographer’s quotes, sometimes called “curly” or “smart” quotes. So basically it takes "this" and makes it “this” using the proper HTML entities. It also works with single quotes, apostrophes, and multi-paragraph double quotes. It slices and dices!

Why? Because there is no button for a curly quote or apostrophe on the keyboard. No really, see the old post for more.

17 replies on “Curly Quotes in Movable Type”

Curly Quotes in MovableType
If you’re a stickler for typography and prefer the look of curly, or more traditionally typographer’s quotes, in your HTML code, until now you had three choices. One, type &#8220; / &#8221; by hand, each and every time you wanted stylized quo…

Wonderful! The graphic design teacher at the college has been chiding me for months about using those blasted “foot” marks or whatever they are called.

Retribution!

Movable Type: CurlyQuotes module
photomatt | Curly Quotes for Movable Type Automagically generated curly quotes without putting curly quotes in your outbound weblog e-mails or other forms that don’t handle HTML entities. Spotted on one of Atlanta’s prettiest weblogs, What Do I Know.

Your hyperlink to “Movable Type” at the top is pointing to “http://movabletype.com” while I believe what you want is “http://movabletype.org”.

Brad Choate over at bradchoate.com also wrote a plug-in that can handle this. His MTMacro plug-in allows for the finding and replacing of quotes in body text too. I’m not sure if it is slower or faster than this plug-in so be sure to check it out too.

How does it handle units of measurement? Feet and inches (as in 6’8″) should be displayed with prime and double prime and never “curly” quotes.

If you’re going to be posting code or something that like where the prime marks are appropiate, I would recommend writing the HTML entities for them. It’s a matter of cost/benefit analysis: do you write apostrophes and quotes more or measurements? If you use measurements more, then maybe this isn’t for you. Just for reference the HTML entity for a single prime is &#039; and a double can be either &quot; or &#034;. (I had a hard time finding the single quote entity before.)

Why don’t we use these HTML entities for the apostrophese and quotes?

&lsquo; for ‘
&rsquo; for ’
&ldquo; for “
&rdquo; for ”

and these for the prime and foot marks?

&prime; for ′
&Prime; for ″

It it based on browser support for those entites or something?

thanks,
john

Browser support is exactly the problem. Most notably NS4 has dismal support for named entities. Decimal notation (what I used) is the most consistent across platforms, better than hexadecimal, named, and unicode entities. Let me know if you have any more questions.

gotcha, matt.

so you’re saying that you’re using

&#8216; for ‘
&#8217; for ’
&#8220; for “
&#8221; for ”

What about adding a case where if the user has entered 8’6″ or [number]'[number]” or I’d think to cover yourself 8′ 1/2″ [number]'[space][number]/[number]” you’d insert the correct marks:

&#8242; for ′ [&prime;]
&#8243; for ″ [&Prime;]

? sound hard to do, or way out there?

(I’m by no means a REGEX knowledgeable guy, but it [always] sounds simple enough)

john

Since I’m completely unable to read and comprehend Perl code, is there some place where you explain the code logic behind the replacements ?
I’m asking this because I’m planning to implement that as a Smarty modifier for b2 1.0 templates. đŸ˜‰

Is there any way to turn curlyquotes off for certain circumstances-inside a tag for instance? The typographer in me _loves_ seeing the correct quotes, but the barely-competent web guy hates it when the link that pops up a new window gets the size wrong.

Does this make _any_ sense?

Comments are closed.