-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: generate module docs from spec (#450)
* docs: generate from spec * update module spec layout * minor revisions * revert proto changes * revert proto changes * update module order * add github markdown * add github markdown Co-authored-by: ryanchrypto <12519942+ryanchrypto@users.noreply.github.com> Co-authored-by: Ru Horlick <ruperthorlick@gmail.com>
- Loading branch information
1 parent
e8a85d1
commit adcf73f
Showing
28 changed files
with
208 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ dist | |
.basement | ||
config.local.js | ||
basement_dist | ||
modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var child_process = require("child_process"); | ||
|
||
function replaceUnsafeChar(ch) { | ||
return HTML_REPLACEMENTS[ch]; | ||
} | ||
|
||
var HTML_REPLACEMENTS = { | ||
"&": "&", | ||
"<": "<", | ||
">": ">", | ||
'"': """, | ||
}; | ||
|
||
function escapeHtml(str) { | ||
if (/[&<>"]/.test(str)) { | ||
return str.replace(/[&<>"]/g, replaceUnsafeChar); | ||
} | ||
return str; | ||
} | ||
|
||
module.exports = function asciiDiagram(md, options) { | ||
md.renderer.rules.text = function (tokens, idx, options, env) { | ||
const a = tokens[idx].content.split(" "); | ||
if (a[0] == "+++" && a[1]) { | ||
const isGithub = /github.com/.test(a[1]); | ||
const url = isGithub | ||
? a[1] | ||
.replace("github.com", "raw.githubusercontent.com") | ||
.replace("/blob/", "/") | ||
: a[1]; | ||
let data = child_process.spawnSync("curl", [url]).stdout.toString(); | ||
const hasLines = a[1].match(/#L[0-9]+-L[0-9]+$/); | ||
const golang = !!a[1].replace(/#L.*$/, "").match(/\.go$/); | ||
if (data && hasLines) { | ||
const [lineStart, lineEnd] = | ||
hasLines && | ||
hasLines[0].replace(/#/g, "").replace(/L/g, "").split("-"); | ||
data = data | ||
.split("\n") | ||
.slice(+lineStart - 1, +lineEnd) | ||
.join("\n"); | ||
} | ||
const lang = golang && "go"; | ||
return `<div class="language-${lang} extra-class"><pre class="language-${lang}"><code>${data}</code></pre></div>`; | ||
} | ||
return escapeHtml(tokens[idx].content); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p modules | ||
|
||
for D in ../x/*; do | ||
if [ -d "${D}" ]; then | ||
rm -rf "modules/$(echo $D | awk -F/ '{print $NF}')" | ||
mkdir -p "modules/$(echo $D | awk -F/ '{print $NF}')" && cp -r $D/spec/* "$_" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# State |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Msg Service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Client | ||
|
||
The `tx` (transaction) and `q` (query) subcommands below give a good illustration | ||
of how this module can be used in practice: | ||
|
||
### Data Transactions | ||
|
||
```sh | ||
$ regen tx data --help | ||
# Data transaction subcommands | ||
# | ||
# Usage: | ||
# regen tx data [flags] | ||
# regen tx data [command] | ||
# | ||
# Available Commands: | ||
# anchor Anchors a piece of data to the blockchain based on its secure | ||
# hash, effectively providing a tamper resistant timestamp. | ||
# sign Sign an arbitrary piece of data on the blockchain. | ||
# store Store a piece of data corresponding to a CID on the blockchain. | ||
``` | ||
|
||
### Data Queries | ||
|
||
```sh | ||
$ regen q data --help | ||
# Querying commands for the data module. | ||
# If a CID is passed as first argument, then this command will query | ||
# timestamp, signers and content (if available) for the given CID. Otherwise, | ||
# this command will run the given subcommand. | ||
# | ||
# Example (the two following commands are equivalent): | ||
# $ regen query data bafzbeigai3eoy2ccc7ybwjfz5r3rdxqrinwi4rwytly24tdbh6yk7zslrm | ||
# $ regen query data by-cid bafzbeigai3eoy2ccc7ybwjfz5r3rdxqrinwi4rwytly24tdbh6yk7zslrm | ||
# | ||
# Usage: | ||
# regen query data [cid] [flags] | ||
# regen query data [command] | ||
# | ||
# Available Commands: | ||
# by-cid Query for CID timestamp, signers and content (if available) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Data Module | ||
|
||
::: tip COMING SOON | ||
The data module is under active development. Check back soon for more information. | ||
::: | ||
|
||
## Abstract | ||
|
||
The following documents specify the data module. | ||
|
||
The data module is intended to be a versatile module for anchoring, signing, and storing data about ecological health, and ecosystem services on Regen Ledger. | ||
|
||
## Contents | ||
|
||
1. **[Concepts](01_concepts.md)** | ||
|
||
<!-- 2. **[State](02_state.md)** | ||
3. **[Msg Service](03_messages.md)** | ||
4. **[Events](04_events.md)** | ||
5. **[Client](05_client.md)** --> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Concepts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# State |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Msg Service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Ecocredit Module | ||
|
||
::: tip COMING SOON | ||
The ecocredit module is under active development. Check back soon for more information. | ||
::: | ||
|
||
## Abstract | ||
|
||
The following documents specify the ecocredit module. | ||
|
||
The ecocredit module enables the ability to define and manage the issuance of new classes of credits for ecosystem services that represent positive ecological health (i.e. soil health credits, carbon credits, biodiversity credits, etc). | ||
|
||
<!-- ## Contents | ||
1. **[Concepts](01_concepts.md)** | ||
2. **[State](02_state.md)** | ||
3. **[Msg Service](03_messages.md)** | ||
4. **[Events](04_events.md)** | ||
5. **[Client](05_client.md)** --> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<!-- | ||
order: 1 | ||
--> | ||
|
||
# Concepts | ||
|
||
## Group | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<!-- | ||
order: 3 | ||
--> | ||
|
||
# Msg Service | ||
|
||
## Msg/CreateGroup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<!-- | ||
order: 4 | ||
--> | ||
|
||
# Events | ||
|
||
The group module emits the following events: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.