https://github.com/xieyuheng/tangle-rs
a collection of tools to do tangle in rust
https://github.com/xieyuheng/tangle-rs
literate-programming org-mode parsing
Last synced: 6 months ago
JSON representation
a collection of tools to do tangle in rust
- Host: GitHub
- URL: https://github.com/xieyuheng/tangle-rs
- Owner: xieyuheng
- License: gpl-3.0
- Created: 2018-10-02T06:53:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T16:16:15.000Z (almost 6 years ago)
- Last Synced: 2024-12-08T07:42:51.470Z (7 months ago)
- Topics: literate-programming, org-mode, parsing
- Language: Rust
- Homepage:
- Size: 62.5 KB
- Stars: 25
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
Awesome Lists containing this project
README
# tangle in rust
A collection of tools to do tangle in rust.
## Getting Start
To build the program, nightly rust toolchain is needed.
`rustup` is the tool to help programmers install rust toolchains.
- One can get rustup from :: https://rustup.rsThen do:
```
rustup install nightly
cargo +nightly install tangle-cli --git https://github.com/xieyuheng/tangle-rs
```## org-mode
In a `.org` file
- Add tangle property-line
```
#+property: tangle lib.rs
```- The following code block will be tangled into `lib.rs`
```
#+begin_src rust
fn tangle (string: &str) -> Result {
let mut result = String::new ();
let mut lines = string.lines ();
while let Some (line) = lines.next () {
if block_begin_line_p (line) {
tangle_collect (&mut result, &mut lines)?;
}
}
Ok (result)
}
#+end_src
```### Note About Restriction on org-mode
- The use case is restricted to global tangle property-line
- code block level tangle property-line is NOT supported
- headline level tangle property-line is NOT supportedCheck out https://github.com/OrgTangle for alternative tangle support.
## Markdown
In a `.md` file
- Add tangle property-line
```
---
tangle: lib.rs
---
```- The following code block will be tangled into `lib.rs`
````
``` rust
fn tangle (string: &str) -> Result {
let mut result = String::new ();
let mut lines = string.lines ();
while let Some (line) = lines.next () {
if block_begin_line_p (line) {
tangle_collect (&mut result, &mut lines)?;
}
}
Ok (result)
}
```
````## Contributing
We enforce C4 as collaboration protocol :
- [The C4 RFC](https://rfc.zeromq.org/spec:42/C4)
- [Style Guide](STYLE-GUIDE.md) -- observe the style of existing code and respect it
- CI [](https://travis-ci.org/xieyuheng/tangle-rs)## Code Of Conduct
- [Contributor Covenant Code of Conduct](CODE-OF-CONDUCT.md)
## License
- [GPLv3](LICENSE)