EDIT: see post #25 - new version
Here's a new 'smarten' (quotes/mdash/ndash/hellip) plugin, should be an improvement on the smartyPants version.
Also has an apos_exceptions.txt file which you should edit and add/remove words you want that begin with an apostrophe, it's case SENSITIVE, so if a word could also be at beginning of a sentence include another line with that capitalised word, such as tis and Tis, one word on each line, WITHOUT the apostrophe.
There's a few usual ones in there already, but edit as you see fit.
One I deliberately left off was Cause as it could also be non apostophe'd.
as in the examples
"'Cause I said so!"
'Cause of death?'
whereas it's lower-cased version would usually be apostrophe'd
The mdash and ndash entities are converted from dashes, -- is ndash, and --- is mdash, if you want them the other way round you need to change the lines 56/57 in the smarten.py file, remove one of the three dashes from line 56 and add one to the two in line 57.
Usual disclaimers apply.
Any problems or quote-cases to add, please let me know.
Edit:
If you don't want it to do any of the (m/n)dash or ellipsis entities, you can comment out the lines (add a # to beginning of the line) in the smarten.py file
30, 31, 32 (calculate extras for the entities)
42, (add pre tags to comments)
56, 57, 58 (convert the entities)
119 (remove the pre tags from comments)
Edit 2:
If you do the commenting out you will need to add
Code:
text = re.sub(r"""(?<=-\s)"(?=\s)""", r"""”""", text) # rd
text = re.sub(r"""(?<=-\s)'(?=\s)""", r"""’""", text) # rs
straight after lines 87/88 - as the n/m-dash entities may no longer be there, so we need to check for a normal dash instead.