Skip to content

Commit c899732

Browse files
committed
Cleaned up code and added comments for clarity
1 parent b8bb388 commit c899732

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bin/generate_reference_pages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
import mkdocs_gen_files
44

55
def generate_pages(path, output_dir, parent, nav=None):
6+
"""
7+
Walks through the path and generates markdown files that
8+
include the corresponding html snippets in it.
9+
"""
610
with os.scandir(path) as it:
711
entries = sorted(it, key= lambda e: e.name)
812
for folder in entries:
913
dir_name = folder.name + ".md"
10-
# print(dir_name)
11-
# Make md file storing its snippet
1214
file_path = os.path.join(output_dir, dir_name)
13-
# print(file_path)
1415

1516
with open(file_path, 'w') as f:
1617
f.write(f'# {folder.name}\n')
1718
f.write(f'--8<-- \"{parent}/{folder.name}/index.html\"\n')
1819

19-
# Add to navigation
20+
# Add markdown file to navigation
2021
if nav is not None:
2122
nav[(folder.name)] = dir_name
2223

2324
it.close()
2425

2526
nav = mkdocs_gen_files.Nav()
2627

27-
# Walk through the docs/tmp/ directory and generate .md files that include the html snippets in it
2828
parent = Path(__file__).resolve().parents[1]
2929
ref_path = f"{parent}/docs/tmp/reference"
3030
ref_output_dir = f"{parent}/pages/reference/"

0 commit comments

Comments
 (0)