org-mode parser in rust
Go to file
2023-09-14 02:18:49 -04:00
.lighthouse Add the foreign document test to the CI. 2023-09-06 16:00:09 -04:00
docker Add worg to the foreign document test. 2023-09-13 20:10:50 -04:00
elisp_snippets Only allow specific keywords for affiliated keywords. 2023-08-29 16:56:07 -04:00
notes Put all trailing whitespace ownership test cases into the automated tests. 2023-08-20 16:03:31 -04:00
org_mode_samples Add a test showing we are not handling fast access states in todo keywords. 2023-09-14 02:18:49 -04:00
scripts Make parse and compare their own binaries. 2023-09-09 04:21:34 -04:00
src Handle the possibility of a title-less headline. 2023-09-14 02:01:24 -04:00
tests Reduce the exposed functions when compare feature is enabled. 2023-09-12 15:48:37 -04:00
.dockerignore Prefix the automatically generated tests. 2023-08-20 23:53:11 -04:00
.gitignore Initial setup for the parser. 2022-07-16 14:17:33 -04:00
build.rs Add cargo directive to rebuild the auto-generated tests when files under org_mode_samples get updated. 2023-09-13 21:28:44 -04:00
Cargo.toml Publish version 0.1.7. 2023-09-12 16:15:53 -04:00
LICENSE Add a license. 2022-07-17 18:45:51 -04:00
Makefile Add a top-level makefile target for running the foreign document test. 2023-09-06 16:17:42 -04:00
README.md Update the README to have instructions on running the tests and development programs. 2023-09-13 20:10:14 -04:00
rustfmt.toml Add an exit matcher to plain text. 2023-04-22 19:46:27 -04:00

Organic - Free Range Org-Mode

Organic is an emacs-less implementation of an org-mode parser.

Project Status

This project is a personal learning project to grow my experience in rust. It is under development and at this time I would not recommend anyone use this code. The goal is to turn this into a project others can use, at which point more information will appear in this README.

Using this library

TODO: Add section on using Organic as a library (which is the intended use for this project).

The parse binary

This program takes org-mode input either streamed in on stdin or as paths to files passed in as arguments. It then parses them using Organic and dumps the result to stdout. This program is intended solely as a development tool. Examples:

cat /foo/bar.org | cargo run --bin parse
cargo build --profile release-lto
./target/release-lto/parse /foo/bar.org /lorem/ipsum.org

The compare binary

This program takes org-mode input either streamed in on stdin or as paths to files passed in as arguments. It then parses them using Organic and the official Emacs Org-mode parser and compares the parse result. This program is intended solely as a development tool. Since org-mode is a moving target, it is recommended that you run this through docker since we pin the version of org-mode to a specific revision. Examples:

cat /foo/bar.org | ./scripts/run_docker_compare.bash
./scripts/run_docker_compare.bash /foo/bar.org /lorem/ipsum.org

Not recommended since it is not through docker:

cat /foo/bar.org | cargo run --features compare --bin compare
cargo build --profile release-lto --features compare
./target/release-lto/compare /foo/bar.org /lorem/ipsum.org

Running the tests

There are three levels of tests for this repository: the standard tests, the autogenerated tests, and the foreign document tests.

The standard tests

These are regular hand-written rust tests. These can be run with:

make unittest

The auto-generated tests

These tests are automatically generated from the files in the org_mode_samples directory and they are still integrated with the rust/cargo testing framework. For each org-mode document in that folder, a test is generated that will parse the document with both Organic and the official Emacs Org-mode parser and then it will compare the parse results. Any deviation is considered a failure. Since org-mode is a moving target, it is recommended that you run these tests inside docker since the organic-test docker image is pinned to a specific revision of org-mode. These can be run with:

make dockertest

The foreign document tests

These tests function the same as the auto-generated tests except they are not integrated with the rust/cargo testing framework and they involve comparing the parse of org-mode documents that live outside this repository. This allows us to test against a far greater variety of org-mode input documents without pulling massive sets of org-mode documents into this repository. The recommended way to run these tests is still through docker because it pins org-mode and the test documents to specific git revisions. These can be run with:

make foreign_document_test

License

This project is released under the public-domain-equivalent 0BSD license, however, this project has a couple permissively licensed non-public-domain-equivalent dependencies which require their copyright notices and/or license texts to be included. I am not a lawyer and this is not legal advice but it is my layperson's understanding that if you distribute a binary statically linking this library, you will need to abide by their terms since their code will also be linked in your binary.