-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
57 additions
and
41 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 |
---|---|---|
|
@@ -11,4 +11,5 @@ book | |
*_py.dot | ||
*_py.svg | ||
__pycache__ | ||
*extract.md | ||
*.mkd | ||
docs/SUMMARY.md |
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,17 +1,21 @@ | ||
.NOTINTERMEDIATE: | ||
|
||
PYSVGs=$(subst _dot.py,_py.svg,$(shell find docs/ -name "*_dot.py")) | ||
EXTRACTMDs=docs/reference/default_extract.md | ||
doc: $(shell find . -name "*.md") ${PYSVGs} ${EXTRACTMDs} | ||
EXTRACTMKDs=docs/references/default_extract.mkd | ||
MDs=$(shell find . -name "*.md") | ||
doc: ${MDs} docs/SUMMARY.md ${PYSVGs} ${EXTRACTMKDs} | ||
mdbook build | ||
|
||
%_py.dot: %_dot.py docs/designs/builders/images/common.py | ||
docs/SUMMARY.md: ./docs/generate_summary.py $(filter-out %SUMMARY.md,${MDs}) | ||
$< $(dir $<) > $@ | ||
|
||
%_py.dot: %_dot.py docs/designs/4.builders/images/common.py | ||
python3 $< | ||
%.svg: %.dot | ||
dot -Tsvg $< -o $@ | ||
# css can only recognize intrinsic size in px | ||
# https://developer.mozilla.org/en-US/docs/Glossary/Intrinsic_Size | ||
sed -i 's/\([0-9]\+\)pt/\1px/g' $@ | ||
|
||
docs/reference/default_extract.md: ./docs/extract_comments.py default.nix | ||
docs/references/default_extract.mkd: ./docs/extract_comments.py default.nix | ||
$^ $@ |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
docs/designs/benchmarks/spec2006.md → docs/designs/3.benchmarks/spec2006.md
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,4 +1,4 @@ | ||
TODO: | ||
# SPEC CPU 2006 | ||
|
||
## Preparing SPEC CPU2006 Source Code | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,44 @@ | ||
#!/usr/bin/env python3 | ||
import glob, re, sys | ||
|
||
if len(sys.argv) < 2: | ||
print(f"Usage: {sys.argv[0]} <docs_dir>") | ||
sys.exit(1) | ||
|
||
def generate_section_body(root_dir:str, sub_dir:str) -> list[str]: | ||
mds_path = glob.glob(f"{sub_dir}/**/*.md", root_dir=root_dir, recursive=True) | ||
mds_path = sorted(mds_path, key=lambda path: path.rstrip("index.md")) | ||
entries: list[str] = [] | ||
levels: list[int] = [] | ||
for md_path in mds_path: | ||
level = md_path.count('/') | ||
if md_path.endswith("index.md"): | ||
level -= 1 | ||
title: str | ||
with open(f"{root_dir}/{md_path}", 'r') as f: title = (re.findall("^# (.*)", f.readline())+[""])[0] | ||
entries.append(f"{' '*level}* [{title}]({md_path})") | ||
levels.append(level) | ||
min_level = min(levels) | ||
well_indented_entries = [entry[2*min_level:] for entry in entries] | ||
return well_indented_entries | ||
|
||
print("# Summary") | ||
print("") | ||
print("# 入门(Get Started)") | ||
print("") | ||
print("* [🏠README.md](./index.md)") | ||
print("") | ||
print("# 使用(Usages)") | ||
print("") | ||
for line in generate_section_body(sys.argv[1], "usages/"): | ||
print(line) | ||
print("") | ||
print("# 设计(Designs)") | ||
print("") | ||
for line in generate_section_body(sys.argv[1], "designs/"): | ||
print(line) | ||
print("") | ||
print("# 参考(References)") | ||
print("") | ||
for line in generate_section_body(sys.argv[1], "references/"): | ||
print(line) |
2 changes: 1 addition & 1 deletion
2
docs/reference/configurable.md → docs/references/1.configurable.md
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,3 +1,3 @@ | ||
# 🧾可配参数(Configurable Arguments) | ||
|
||
{{ #include ./default_extract.md }} | ||
{{ #include ./default_extract.mkd }} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.