Skip to content

Commit

Permalink
Bump version to 0.3.0 and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
d0rianb committed Apr 28, 2024
1 parent c957be9 commit 9af7a22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -158,11 +160,11 @@ fn main() -> Result<(), Box<dyn Error>> {
}
```

## 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).
Expand Down
3 changes: 1 addition & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'a> Parser<'a> {
pub fn parse(&mut self) -> Result<RtfDocument, ParserError> {
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<ParserState> = vec![ParserState::default()];
Expand Down Expand Up @@ -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}}";
Expand Down

0 comments on commit 9af7a22

Please sign in to comment.