Improve smartypants support

Taken from http://gist.github.com/drdrang/705071

Basically, if a ' or a " is preceded by the beginning of line, dash,
slash, parentheses, brackets, quotes, or whitespace, it's an opening
one. Otherwise it's a closing one.