chore: reorganize directories
This commit is contained in:
parent
42cb1d21bd
commit
14d1555fc1
88 changed files with 114 additions and 144 deletions
30
examples/parse.rs
Normal file
30
examples/parse.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//! ```bash
|
||||
//! cargo run --example parse '* hello\n** /world/!'
|
||||
//! ```
|
||||
|
||||
use orgize::Org;
|
||||
use rowan::ast::AstNode;
|
||||
use std::env::args;
|
||||
use tracing_subscriber::fmt::format::FmtSpan;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<_> = args().collect();
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.without_time()
|
||||
.with_file(true)
|
||||
.with_span_events(FmtSpan::NEW)
|
||||
.with_line_number(true)
|
||||
.with_max_level(tracing::Level::TRACE)
|
||||
.with_file(false)
|
||||
.with_line_number(false)
|
||||
.init();
|
||||
|
||||
if args.len() < 2 {
|
||||
eprintln!("Usage: {} <org-mode-string>", args[0]);
|
||||
} else {
|
||||
let s = &args[1].replace(r"\n", "\n").replace(r"\r", "\r");
|
||||
let org = Org::parse(s);
|
||||
println!("{:#?}", org.document().syntax());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue