Crate crowbook_text_processing [−] [src]
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
use crowbook_text_processing::{ FrenchFormatter, escape_html, escape_tex, remove_whitespaces, }; 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 new_s = remove_whitespaces(s); // Display to HTML println!("for HTML: {}", escape_html(new_s.clone())); // Display to LaTeX println!("for LaTeX: {}", escape_tex(new_s)); // 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: {}", escape_tex(french.format_tex(s)));Run
Requirements
rustc >= 1.6.0
Semantic versioning
While not yet at version 1.0, this crates tries to follows semantic
versioning in the following way:
- an increase of
xin0.x.ymeans breaking changes. - an increase of
yin0.x.ymeans non-breaking changes.
Reexports
pub use escape::{escape_html, escape_tex}; |
pub use clean::remove_whitespaces; |
pub use french::FrenchFormatter; |
Modules
| clean | |
| escape | |
| french |