chore: reorganize directories
This commit is contained in:
parent
42cb1d21bd
commit
14d1555fc1
88 changed files with 114 additions and 144 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
|
@ -45,12 +45,12 @@ jobs:
|
|||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
|
||||
- name: Build
|
||||
run: wasm-pack build -t web -d ./dist --out-name orgize ./orgize-wasm/
|
||||
run: wasm-pack build -t web -d ./dist --out-name orgize ./wasm/
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
with:
|
||||
path: "./orgize-wasm"
|
||||
path: "./wasm"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
|
|
|
|||
36
Cargo.toml
36
Cargo.toml
|
|
@ -1,13 +1,45 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["./orgize", "./orgize-wasm"]
|
||||
members = [".", "./wasm"]
|
||||
|
||||
[workspace.package]
|
||||
[package]
|
||||
name = "orgize"
|
||||
version = "0.10.0-alpha.7"
|
||||
authors = ["PoiScript <poiscript@gmail.com>"]
|
||||
repository = "https://github.com/PoiScript/orgize"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A Rust library for parsing org-mode files."
|
||||
readme = "README.md"
|
||||
keywords = ["orgmode", "org-mode", "emacs", "parser"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
indexmap = ["dep:indexmap"]
|
||||
chrono = ["dep:chrono"]
|
||||
|
||||
[dependencies]
|
||||
bytecount = "0.6"
|
||||
chrono = { version = "0.4", optional = true }
|
||||
indexmap = { version = "2.1", optional = true }
|
||||
jetscii = "0.5"
|
||||
memchr = "2.5"
|
||||
nom = { version = "7.1", default-features = false, features = ["std"] }
|
||||
rowan = "0.15"
|
||||
tracing = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5"
|
||||
insta = "1.29"
|
||||
slugify = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["fmt"] }
|
||||
|
||||
[[bench]]
|
||||
name = "parse"
|
||||
harness = false
|
||||
|
||||
[profile.dev.package]
|
||||
insta.opt-level = 3
|
||||
|
|
|
|||
79
README.md
79
README.md
|
|
@ -1,24 +1,71 @@
|
|||
# Orgize
|
||||
|
||||
[](https://crates.io/crates/orgize)
|
||||
[](https://docs.rs/orgize)
|
||||
[](https://github.com/PoiScript/orgize/actions/workflows/ci.yml)
|
||||

|
||||
|
||||
Org-mode toolkit written in Rust.
|
||||
A Rust library for parsing org-mode files.
|
||||
|
||||
This repository contains several crates/packages:
|
||||
Live Demo: <https://poiscript.github.io/orgize/>
|
||||
|
||||
| Crates/packages | Description |
|
||||
| ----------------------------- | --------------------------------------------------------------- |
|
||||
| [`orgize`] | A pure-rust library for parsing and exporting org-mode files. |
|
||||
| [`orgize-cli`] | Command line utilities for org-mode files, builtin with orgize. |
|
||||
| [`orgize-lsp`] | Language server for org-mode files, builtin with orgize. |
|
||||
| [`orgize-lsp/editors/vscode`] | [`orgize-lsp`] client for vscode editor |
|
||||
| [`orgize-common`] | Shared code for [`orgize-cli`] and [`orgize-lsp`]. |
|
||||
| [`orgize-wasm`] | WebAssembly module for Browser or Node.js environment. |
|
||||
## Parse
|
||||
|
||||
[`orgize`]: ./orgize
|
||||
[`orgize-cli`]: ./orgize-cli
|
||||
[`orgize-lsp`]: ./orgize-lsp
|
||||
[`orgize-lsp/editors/vscode`]: ./orgize-lsp/editors/vscode
|
||||
[`orgize-common`]: ./orgize-common
|
||||
[`orgize-wasm`]: ./orgize-wasm
|
||||
To parse a org-mode string, simply invoking the `Org::parse` function:
|
||||
|
||||
```rust
|
||||
use orgize::{Org, rowan::ast::AstNode};
|
||||
|
||||
let org = Org::parse("* DONE Title :tag:");
|
||||
assert_eq!(
|
||||
format!("{:#?}", org.document().syntax()),
|
||||
r#"DOCUMENT@0..18
|
||||
HEADLINE@0..18
|
||||
HEADLINE_STARS@0..1 "*"
|
||||
WHITESPACE@1..2 " "
|
||||
HEADLINE_KEYWORD_DONE@2..6 "DONE"
|
||||
WHITESPACE@6..7 " "
|
||||
HEADLINE_TITLE@7..13
|
||||
TEXT@7..13 "Title "
|
||||
HEADLINE_TAGS@13..18
|
||||
COLON@13..14 ":"
|
||||
TEXT@14..17 "tag"
|
||||
COLON@17..18 ":"
|
||||
"#);
|
||||
```
|
||||
|
||||
use `ParseConfig::parse` to specific a custom parse config
|
||||
|
||||
```rust
|
||||
use orgize::{Org, ParseConfig, ast::Headline};
|
||||
|
||||
let config = ParseConfig {
|
||||
// custom todo keywords
|
||||
todo_keywords: (vec!["TASK".to_string()], vec![]),
|
||||
..Default::default()
|
||||
};
|
||||
let org = config.parse("* TASK Title 1");
|
||||
let hdl = org.first_node::<Headline>().unwrap();
|
||||
assert_eq!(hdl.todo_keyword().unwrap(), "TASK");
|
||||
```
|
||||
|
||||
## Render to html
|
||||
|
||||
Call the `Org::to_html` function to export org element tree to html:
|
||||
|
||||
```rust
|
||||
use orgize::Org;
|
||||
|
||||
assert_eq!(
|
||||
Org::parse("* title\n*section*").to_html(),
|
||||
"<main><h1>title</h1><section><p><b>section</b></p></section></main>"
|
||||
);
|
||||
```
|
||||
|
||||
Checkout `examples/html-slugify.rs` on how to customizing html export process.
|
||||
|
||||
## Features
|
||||
|
||||
- **`chrono`**: adds the ability to convert `Timestamp` into `chrono::NaiveDateTime`, disabled by default.
|
||||
|
||||
- **`indexmap`**: adds the ability to convert `PropertyDrawer` properties into `IndexMap`, disabled by default.
|
||||
|
|
|
|||
0
orgize/fuzz/.gitignore → fuzz/.gitignore
vendored
0
orgize/fuzz/.gitignore → fuzz/.gitignore
vendored
|
|
@ -1,15 +0,0 @@
|
|||
[package]
|
||||
name = "orgize-wasm"
|
||||
publish = false
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
repository.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
orgize = { path = "../orgize" }
|
||||
wasm-bindgen = "0.2"
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
[package]
|
||||
name = "orgize"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "A Rust library for parsing org-mode files."
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
keywords = ["orgmode", "org-mode", "emacs", "parser"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
indexmap = ["dep:indexmap"]
|
||||
chrono = ["dep:chrono"]
|
||||
|
||||
[dependencies]
|
||||
bytecount = "0.6"
|
||||
chrono = { version = "0.4", optional = true }
|
||||
indexmap = { version = "2.1", optional = true }
|
||||
jetscii = "0.5"
|
||||
memchr = "2.5"
|
||||
nom = { version = "7.1", default-features = false, features = ["std"] }
|
||||
rowan = "0.15"
|
||||
tracing = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5"
|
||||
insta = "1.29"
|
||||
slugify = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["fmt"] }
|
||||
|
||||
[[bench]]
|
||||
name = "parse"
|
||||
harness = false
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
# Orgize
|
||||
|
||||
[](https://crates.io/crates/orgize)
|
||||
[](https://docs.rs/orgize)
|
||||
[](https://github.com/PoiScript/orgize/actions/workflows/ci.yml)
|
||||

|
||||
|
||||
A Rust library for parsing org-mode files.
|
||||
|
||||
Live Demo: <https://poiscript.github.io/orgize/>
|
||||
|
||||
## Parse
|
||||
|
||||
To parse a org-mode string, simply invoking the `Org::parse` function:
|
||||
|
||||
```rust
|
||||
use orgize::{Org, rowan::ast::AstNode};
|
||||
|
||||
let org = Org::parse("* DONE Title :tag:");
|
||||
assert_eq!(
|
||||
format!("{:#?}", org.document().syntax()),
|
||||
r#"DOCUMENT@0..18
|
||||
HEADLINE@0..18
|
||||
HEADLINE_STARS@0..1 "*"
|
||||
WHITESPACE@1..2 " "
|
||||
HEADLINE_KEYWORD_DONE@2..6 "DONE"
|
||||
WHITESPACE@6..7 " "
|
||||
HEADLINE_TITLE@7..13
|
||||
TEXT@7..13 "Title "
|
||||
HEADLINE_TAGS@13..18
|
||||
COLON@13..14 ":"
|
||||
TEXT@14..17 "tag"
|
||||
COLON@17..18 ":"
|
||||
"#);
|
||||
```
|
||||
|
||||
use `ParseConfig::parse` to specific a custom parse config
|
||||
|
||||
```rust
|
||||
use orgize::{Org, ParseConfig, ast::Headline};
|
||||
|
||||
let config = ParseConfig {
|
||||
// custom todo keywords
|
||||
todo_keywords: (vec!["TASK".to_string()], vec![]),
|
||||
..Default::default()
|
||||
};
|
||||
let org = config.parse("* TASK Title 1");
|
||||
let hdl = org.first_node::<Headline>().unwrap();
|
||||
assert_eq!(hdl.todo_keyword().unwrap(), "TASK");
|
||||
```
|
||||
|
||||
## Render to html
|
||||
|
||||
Call the `Org::to_html` function to export org element tree to html:
|
||||
|
||||
```rust
|
||||
use orgize::Org;
|
||||
|
||||
assert_eq!(
|
||||
Org::parse("* title\n*section*").to_html(),
|
||||
"<main><h1>title</h1><section><p><b>section</b></p></section></main>"
|
||||
);
|
||||
```
|
||||
|
||||
Checkout `examples/html-slugify.rs` on how to customizing html export process.
|
||||
|
||||
## Features
|
||||
|
||||
- **`chrono`**: adds the ability to convert `Timestamp` into `chrono::NaiveDateTime`, disabled by default.
|
||||
|
||||
- **`indexmap`**: adds the ability to convert `PropertyDrawer` properties into `IndexMap`, disabled by default.
|
||||
0
orgize-wasm/.gitignore → wasm/.gitignore
vendored
0
orgize-wasm/.gitignore → wasm/.gitignore
vendored
15
wasm/Cargo.toml
Normal file
15
wasm/Cargo.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "orgize-wasm"
|
||||
publish = false
|
||||
version = "0.10.0-alpha.7"
|
||||
authors = ["PoiScript <poiscript@gmail.com>"]
|
||||
repository = "https://github.com/PoiScript/orgize"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
orgize = { path = ".." }
|
||||
wasm-bindgen = "0.2"
|
||||
Loading…
Add table
Add a link
Reference in a new issue