Function crowbook_text_processing::clean::quotes [] [src]

pub fn quotes<'a, S: Into<Cow<'a, str>>>(input: S) -> Cow<'a, str>

Replace straight quotes with more typographic variants

While it should work pretty well for double quotes ("), the rules for single quote (') are more ambiguous, as it can be a quote or an apostrophe and it's not that easy (and, in some circumstances, impossible without understanding the meaning of the text) to get right.

Example

use crowbook_text_processing::clean;
let s = clean::quotes("\"foo\"");
assert_eq!(&s, "“foo”");
let s = clean::quotes("'foo'");
assert_eq!(&s, "‘foo’");