From 9af7a225b897bac315c493d9aa6c0eb0bc4da591 Mon Sep 17 00:00:00 2001 From: d0rianb Date: Sun, 28 Apr 2024 12:50:05 +0200 Subject: [PATCH] Bump version to 0.3.0 and reformat --- Cargo.toml | 2 +- README.md | 10 ++++++---- src/parser.rs | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4eddca..cd65198 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "rtf-parser" description = "A Rust RTF parser & lexer library designed for speed and memory efficiency." repository = "https://github.com/d0rianb/rtf-parser" -version = "0.2.2" +version = "0.3.0" edition = "2021" license = "MIT" keywords = ["rtf", "rich", "text", "format", "parser"] diff --git a/README.md b/README.md index 9e4632b..b98b69f 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ [![Crates.io Total Downloads](https://img.shields.io/crates/d/rtf-parser?style=flat-square&color=violet)](https://crates.io/crates/rtf-parser) [![docs.rs](https://img.shields.io/docsrs/rtf-parser?style=flat-square)](https://docs.rs/rtf-parser) -A safe Rust RTF parser & lexer library designed for speed and memory efficiency, with no external dependencies, with UTF-16 unicode support. - +A safe Rust RTF parser & lexer library designed for speed and memory efficiency, with no external dependencies. + +It implements the last version of the RTF specification (1.9), with modern UTF-16 unicode support. + The official documentation is available at [docs.rs/rtf-parser](https://docs.rs/rtf-parser). ## Installation @@ -158,11 +160,11 @@ fn main() -> Result<(), Box> { } ``` -## Known limitaion +## Known limitations For now, the `\bin` keyword is not taken into account. As its content is text in binary format, it can mess with the lexing algorithm, and crash the program. Future support for the binary will soon come. -The base64 images are not supported as well, but can be safely parse. +The base64 images are not supported as well, but can safely be parsed. ## Benchmark For now, there is no comparable crates to [`rtf-parser`](https://crates.io/crates/rtf-parser). diff --git a/src/parser.rs b/src/parser.rs index b6eb631..b019bf2 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -129,7 +129,7 @@ impl<'a> Parser<'a> { pub fn parse(&mut self) -> Result { self.check_document_validity()?; let mut document = RtfDocument::default(); // Init empty document - // Traverse the document and consume the header groups (FontTable, StyleSheet, etc ...) + // Traverse the document and consume the header groups (FontTable, StyleSheet, etc ...) document.header = self.parse_header()?; // Init the state of the docuement. the stack is used to keep track of the different scope changes. let mut state_stack: Vec = vec![ParserState::default()]; @@ -730,7 +730,6 @@ pub mod tests { assert_eq!(&document.body[4].text, "bĂȘĂȘte"); } - #[test] fn body_starts_with_a_group() { let rtf = r"{\rtf1\ansi\deff0{\fonttbl {\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset2 Symbol;}}{\colortbl ;}{\pard \u21435 \sb70\par}}";