-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): automate collection and organization of docs (#560)
* init * fixes * more fixes * add docs for docs * more * more * fix ci * move g-ignore to docs/ * update
- Loading branch information
1 parent
01a8896
commit 9d9aba7
Showing
96 changed files
with
1,286 additions
and
479 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
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,21 @@ | ||
# dependencies | ||
docusaurus/node_modules | ||
|
||
# production | ||
docusaurus/build | ||
|
||
# generated files | ||
docusaurus/.docusaurus | ||
docusaurus/.cache-loader | ||
|
||
# misc | ||
docusaurus/.env.local | ||
docusaurus/.env.development.local | ||
docusaurus/.env.test.local | ||
docusaurus/.env.production.local | ||
docusaurus/npm-debug.log* | ||
docusaurus/yarn-debug.log* | ||
docusaurus/yarn-error.log* | ||
|
||
# python scripts | ||
__pycache__ |
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,40 @@ | ||
import argparse | ||
import os | ||
|
||
import generate as g | ||
|
||
# checks if the docs folder is up to date with the source readme.md files | ||
if __name__ == "__main__": | ||
arg_parser = argparse.ArgumentParser() | ||
arg_parser.add_argument("src_dir") | ||
args = arg_parser.parse_args() | ||
|
||
exclude_dirs = [ | ||
args.src_dir + "docs", # dont search yourself | ||
args.src_dir + "data", # this should only include data | ||
] | ||
|
||
code_path = os.path.join(args.src_dir, "docs/docusaurus/docs/code") | ||
for name, src_path in g.get_markdown_files(args.src_dir, exclude_dirs): | ||
docs_path = os.path.join(code_path, name + ".md") | ||
|
||
# check to see if the files are the same ! | ||
with open(src_path, "r") as src_f: | ||
with open(docs_path, "r") as docs_f: | ||
src_lines = src_f.readlines() | ||
# fix image paths for docusaurus | ||
for i in range(0, len(src_lines)): | ||
if "/docs/docusaurus/static/img" in src_lines[i]: | ||
src_lines[i] = src_lines[i].replace("/docs/docusaurus/static/img", "/img") | ||
|
||
docs_lines = docs_f.readlines() | ||
if src_lines != docs_lines: | ||
print("Docs folder is not up to date, run generate.py") | ||
# print the the first difference | ||
for i in range(len(src_lines)): | ||
if src_lines[i] != docs_lines[i]: | ||
print("Difference found at line", i) | ||
print("Source:", src_lines[i]) | ||
print("Docs:", docs_lines[i]) | ||
break | ||
exit(1) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.