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:
- Install the MTRegex plugin. (Directions from readme.txt file)
- Get file.
- Place the ‘regex.pl’ file in your Movable Type “plugins” directory
- Place ‘regex.pm’ and ‘postproc.pm’ in a ‘bradchoate’ subdirectory underneath your Movable Type “extlib” directory.
- 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
- Create a new template module called
curlyquotes
with the code from here. - Add
<$MTInclude module="curlyquotes"$>
to the top of all your templates. - 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.
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!
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.
Thanks for the heads-up on that link. It’s been fixed.
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
'
and a double can be either"
or"
. (I had a hard time finding the single quote entity before.)Why don’t we use these HTML entities for the apostrophese and quotes?
‘ for ‘
’ for ’
“ for “
” for ”
and these for the prime and foot marks?
′ for ′
″ 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
‘ for ‘
’ for ’
“ for “
” 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:
′ for ′ [′]
″ for ″ [″]
? 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?