diff --git a/Cargo.toml b/Cargo.toml index 7908ad0..414fbcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/PoiScript/orgize" readme = "README.md" edition = "2018" license = "MIT" -keywords = ["orgmode","emacs","parser"] +keywords = ["orgmode", "emacs", "parser"] [badges] travis-ci = { repository = "PoiScript/orgize" } @@ -17,13 +17,13 @@ default = ["serde", "chrono"] extra-serde-info = [] [dependencies] -bytecount = "0.5" -chrono = { version = "0.4", optional = true } +bytecount = "0.5.1" +chrono = { version = "0.4.7", optional = true } indextree = "3.2.0" -jetscii = "0.4" -memchr = "2" -serde = { version = "1.0.93", features = ["derive"], optional = true } -serde_json = "1.0.39" +jetscii = "0.4.4" +memchr = "2.2.0" +serde = { version = "1.0.93", optional = true } [dev-dependencies] +serde_json = "1.0.39" slugify = "0.1.0" diff --git a/examples/json.rs b/examples/json.rs new file mode 100644 index 0000000..b44b529 --- /dev/null +++ b/examples/json.rs @@ -0,0 +1,19 @@ +use orgize::Org; +use serde_json::to_string; +use std::env::args; +use std::fs; +use std::io::Result; + +fn main() -> Result<()> { + let args: Vec<_> = args().collect(); + + if args.len() < 2 { + eprintln!("Usage: {} ", args[0]); + } else { + let contents = String::from_utf8(fs::read(&args[1])?).unwrap(); + let mut org = Org::new(&contents); + org.parse(); + println!("{}", to_string(&org).unwrap()); + } + Ok(()) +}