Stripper v1.1.0 Stripper.Quotes View Source

This module exists for dealing with quotes. When parsing text from word processors or web pages, it is inevitable that you will encounter various smart-quotes, curly quotes, and even some backticks masquerading as apostrophes!

This module will normalize all quotes to their simple straight-laced variants so you can focus on parsing the text. This even handles the weird "Guillemets" (a.k.a. Chevrons) used in some languages.

Link to this section Summary

Functions

The normalize/1 function works the same way as the normalize!/1 function but it returns its output as an :ok tuple.

Replace any smart, curly, or bracket quotes with their boring equivalents " and '.

Link to this section Functions

Link to this function

normalize(string)

View Source
normalize(string :: String.t()) :: {:ok, String.t()}

The normalize/1 function works the same way as the normalize!/1 function but it returns its output as an :ok tuple.

This is a convenience function provided to have idiomatic function specs.

Usage Examples

iex> normalize(~S|make «it» stop|)
{:ok, ~S|'make' "it" "stop"|}
Link to this function

normalize!(string)

View Source
normalize!(string :: String.t()) :: String.t()

Replace any smart, curly, or bracket quotes with their boring equivalents " and '.

Examples

iex> normalize!(~S|make «it» stop|)
~S|'make' "it" "stop"|