crowbook-text-processing

Travis status

Some utilities functions for processing texts.

These functions were originally written for Crowbook, but have been published on a separate crate and under a less restrictive license (MPL instead of LGPL) so they can be used elsewhere.

Example

```rust use crowbooktextprocessing::{ FrenchFormatter, escapehtml, escapetex, removewhitespaces, typographicquotes, ellipsis, };

let s = " Some string with too much whitespaces & around 1% \ characters that might cause trouble to HTML or LaTeX."; // Remove unnecessary whitespaces (but doesn't trim at is can have meaning) let news = removewhitespaces(s); // Escape forHTML println!("for HTML: {}", escapehtml(news.clone())); // Escape for LaTeX println!("for LaTeX: {}", escapetex(news));

// Replace quotes with typographic quotation marks let s = r#"Some "quoted string" and 'another one'."#; let news = typographicquotes(s); asserteq!(&news, "Some “quoted string” and ‘another one’.");

// Replace three consecutive dots with ellipsis character let s = ellipsis("Foo..."); assert_eq!(&s, "Foo…");

// Format whitespaces according to french typographic rules, using // the appropriate non-breaking spaces where needed let s = " Une chaîne en français ! On voudrait un résultat \ « typographiquement correct »."; let french = FrenchFormatter::new(); println!("for text: {}", french.format(s)); println!("for LaTeX: {}", escapetex(french.formattex(s))); ```

Requirements

Semantic versioning

While not yet at version 1.0, this crates tries to follows semantic versioning in the following way: