-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreadme.py
executable file
·51 lines (41 loc) · 2.09 KB
/
readme.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/env python3
# This file automatically generates the README.md file for this repository based upon the first
# section of the crate documentation.
main_readme_links = """
[`dialectic-tokio-mpsc`]: https://crates.io/crates/dialectic-tokio-mpsc
[`dialectic-tokio-serde`]: https://crates.io/crates/dialectic-tokio-serde
[`dialectic-tokio-serde-bincode`]: https://crates.io/crates/dialectic-tokio-serde-bincode
[`dialectic-tokio-serde-json`]: https://crates.io/crates/dialectic-tokio-serde-json
[`bincode`]: https://crates.io/crates/bincode
[`serde_json`]: https://crates.io/crates/serde_json
[tutorial-style tour of the crate]: https://docs.rs/dialectic/latest/dialectic/tutorial/index.html
[quick reference]: https://docs.rs/dialectic/latest/dialectic/#quick-reference
[reference documentation]: https://docs.rs/dialectic
[`types`]: https://docs.rs/dialectic/latest/dialectic/types/index.html
[`Chan`]: https://docs.rs/dialectic/latest/dialectic/struct.Chan.html
[`Transmit`]: https://docs.rs/dialectic/latest/dialectic/backend/trait.Transmit.html
[`Receive`]: https://docs.rs/dialectic/latest/dialectic/backend/trait.Receive.html
[`backend`]: https://docs.rs/dialectic/latest/dialectic/backend/index.html
[`Session!`]: https://docs.rs/dialectic/latest/dialectic/macro.Session.html
"""
with open("README.md", "w") as readme:
readme.write("# Dialectic\n")
with open("dialectic/src/lib.rs", "r") as lib:
for line in lib:
if line.startswith("/*!"):
line = line[3:]
if line.endswith("<!-- snip -->\n"):
break
readme.write(line)
readme.write(main_readme_links)
with open("dialectic-compiler/README.md", "w") as readme:
readme.write("# Dialectic session type macro compiler\n")
with open("dialectic-compiler/src/lib.rs", "r") as lib:
for line in lib:
if line.startswith("/*!"):
line = line[3:]
if line.startswith("```text"):
line = line.replace("```text", "```rust")
if line.endswith("<!-- snip -->\n"):
break
readme.write(line)