edumacator

“Educates” quotes and replaces some other typographic characters like em-dashes (—) and ellipses (…).

It uses a simple algorithm to identify double quotes, single quotes, and apostrophes. Two dashes are replaced by an em-dash, and three dots, with a space or not, are replaced by an ellipsis.

Edumacator.educate %q{Jim's friend mumbled, "I guess..."}

converts to

Jim’s friend mumbled, “I guess…”

It assumes that the text passed in is plain text. Markup such as HTML will not survive being edumacated:

<img src="cat.gif">

would become

<img src=“cat.gif”>

which wouldn’t work so well.

It also assumes English quoting rules, because nobody agrees how to do it. I’m also guessing that writers in languages that use quotes that aren’t like dumb-quotes will use the correct quotes. Submit an issue if I’m wrong!

See TODO.md for future plans.

Contributing to edumacator

Copyright © 2013 Graham Davison. See LICENSE.txt for further details.