Skip to content

Commit 176cb07

Browse files
committed
Fix actiondoc parsing
1 parent a76cd62 commit 176cb07

22 files changed

+32
-36
lines changed

docbuilder/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ edition = "2018"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
serde-hjson = {version= "0.9.1", default-features = false}
10+
serde-hjson = {version= "0.9.1", default-features = false}

docbuilder/src/main.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,47 @@ fn main() {
4444
.arg("actions.jsonc")
4545
.output()
4646
.unwrap();
47-
let json: Value =
48-
serde_hjson::from_str(&output).unwrap();
47+
let json: Value = serde_hjson::from_str(&output).unwrap();
4948
let json = json.as_array().unwrap();
5049
let mut actions = Vec::new();
5150
for val in json {
5251
let obj = val.as_object().unwrap();
5352
let name = obj.get("name").unwrap().to_string();
5453
let id = name.to_lowercase();
55-
let since = obj.get("since").unwrap();
5654
let complexity = obj.get("complexity").unwrap();
5755
let args = obj.get("args").unwrap();
5856
let returns = obj.get("return").unwrap();
5957
let desc = obj.get("desc").unwrap().to_string();
6058
let desc = desc.replace("<br>", " \n");
6159
// Now we have all the details; time to construct the page
6260
let mut actionpage = String::new();
61+
// add the page meta ---
6362
actionpage.push_str("---\n");
63+
// add the document id
6464
actionpage.push_str(&format!("id: {}\n", id));
65+
// add the title
6566
actionpage.push_str(&format!("title: {}\n", name));
67+
// add the page meta end ---
6668
actionpage.push_str("---\n");
69+
// add the note admonition
6770
actionpage.push_str(":::note About\n");
68-
actionpage.push_str(&format!("**Since**: {} \n", since));
71+
// add the time complexity
6972
actionpage.push_str(&format!("**Time complexity**: {} \n", complexity));
73+
// add the arguments
7074
actionpage.push_str(&format!("**Arguments**: `{}` \n", args));
75+
// add the returns
7176
actionpage.push_str(&format!("**Returns**: {} \n", returns));
77+
// add the end of the admonition
7278
actionpage.push_str(":::\n");
73-
actionpage.push_str(&desc);
79+
// add the description
80+
actionpage.push_str(
81+
&desc
82+
.trim()
83+
.replace("<", "&lt;")
84+
.replace(">", "&gt;")
85+
.replace("'''", ""),
86+
);
87+
// now push the action into the collection of actions
7488
actions.push(Document(name, actionpage));
7589
}
7690
actions.sort();
@@ -82,8 +96,8 @@ fn create_docs(list: Vec<Document>) {
8296
filetop.push_str("Actions are like shell commands: they take arguments and do something! Skytable currently supports the following actions: \n\n");
8397
for action in list {
8498
let name = action.0;
85-
filetop.push_str(&format!("* [{}](actions/{}.md)\n", &name, &name));
86-
let mut file = std::fs::File::create(format!("../docs/actions/{}.md", name)).unwrap();
99+
filetop.push_str(&&format!("* [{}](actions/{}.md)\n", &name, &name));
100+
let mut file = std::fs::File::create(&format!("../docs/actions/{}.md", name)).unwrap();
87101
file.write_all(&action.1.into_bytes()).unwrap();
88102
}
89103
let mut file = std::fs::File::create("../docs/actions.md").unwrap();

docs/2.getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Getting started with Skytable is easy 😊 (and fun!). You can get started with
88

99
### Step 1: Download a bundle
1010

11-
Head over to this [page](https://github.com/skytable/skytable/releases/v0.5.2) and download a version for your platform.
11+
Head over to this [page](https://github.com/skytable/skytable/releases/v0.5.3) and download a version for your platform.
1212

1313
### Step 2: Make the files runnable
1414

@@ -34,7 +34,7 @@ First of all, you need to have Docker installed and available on your `PATH` ; y
3434
Open up a terminal and run:
3535

3636
```
37-
docker create skytable/sdb:v0.5.2 --name skyvm
37+
docker create skytable/sdb:v0.5.3 --name skyvm
3838
```
3939

4040
:::note

docs/3.building-from-source.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Besides, the TLS/SSL components are written in C (OpenSSL) &mdash; so you'll nee
1515
### Step 2: Clone the tag
1616
Run this from your terminal:
1717
```
18-
git clone --branch v0.5.2 https://github.com/skytable/skytable.git
18+
git clone --branch v0.5.3 https://github.com/skytable/skytable.git
1919
```
2020
:::tip Bonus tip
2121
If you want to avoid downloading all the version history, run this instead:
2222
```
23-
git clone --depth 1 --branch v0.5.2 https://github.com/skytable/skytable.git
23+
git clone --depth 1 --branch v0.5.3 https://github.com/skytable/skytable.git
2424
```
2525
:::
2626
### Step 3: Build it!

docs/5.benchmarking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Who doesn't like speed and as a consequence, benchmarks? So here's a guide on be
66

77
## Step 0: Getting the benchmarking tool
88

9-
You'll need to download a bundle from the [releases page](https://github.com/skytable/skytable/releases/v0.5.2) and unzip it. In the following steps we'll assume that you have unzipped the archive and you're in that directory.
9+
You'll need to download a bundle from the [releases page](https://github.com/skytable/skytable/releases/v0.5.3) and unzip it. In the following steps we'll assume that you have unzipped the archive and you're in that directory.
1010

1111
## Step 1: Starting the database server
1212

docs/actions/DBSIZE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: dbsize
33
title: DBSIZE
44
---
55
:::note About
6-
**Since**: 0.4.3
76
**Time complexity**: O(1)
87
**Arguments**: `DBSIZE`
98
**Returns**: Number of keys that exist in the database as an unsigned int

docs/actions/DEL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: del
33
title: DEL
44
---
55
:::note About
6-
**Since**: 0.1.0
76
**Time complexity**: O(n)
87
**Arguments**: `DEL <key1> <key2> ...`
98
**Returns**: Number of keys that were deleted as an unsigned int

docs/actions/EXISTS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: exists
33
title: EXISTS
44
---
55
:::note About
6-
**Since**: 0.4.0
76
**Time complexity**: O(n)
87
**Arguments**: `EXISTS <key1> <key2> ...`
98
**Returns**: Number of keys that exist as an unsigned int

docs/actions/FLUSHDB.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: flushdb
33
title: FLUSHDB
44
---
55
:::note About
6-
**Since**: 0.4.3
76
**Time complexity**: O(n)
87
**Arguments**: `FLUSHDB`
98
**Returns**: (Code: 0) if the operation succeeded

docs/actions/GET.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: get
33
title: GET
44
---
55
:::note About
6-
**Since**: 0.1.0
76
**Time complexity**: O(1)
87
**Arguments**: `GET <key>`
98
**Returns**: Value if it exists or (Code: 1) if it does not

0 commit comments

Comments
 (0)