-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
118 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" Generate a YAML representation of a directory structure for mkdocs nav config | ||
mkocs nav Docs: https://www.mkdocs.org/user-guide/writing-your-docs/#file-layout | ||
Inpsire by: https://github.com/mkdocs/mkdocs/issues/714#issuecomment-626226113 | ||
""" | ||
|
||
import yaml | ||
import os | ||
from pprint import pprint | ||
|
||
################################################################################ | ||
# Configuration | ||
################################################################################ | ||
mkdocs_config_file = "mkdocs.yml" | ||
|
||
|
||
################################################################################ | ||
# Helper Functions | ||
################################################################################ | ||
def dir_to_dict(path): | ||
directory = {} | ||
for dirname, dirnames, filenames in os.walk(path): | ||
dn = os.path.basename(dirname) | ||
directory[dn] = [] | ||
|
||
if dirnames: | ||
for d in dirnames: | ||
directory[dn].append(dir_to_dict(path=os.path.join(path, d))) | ||
for f in filenames: | ||
directory[dn].append(f) | ||
else: | ||
directory[dn] = filenames | ||
|
||
return directory | ||
|
||
|
||
|
||
################################################################################ | ||
# Script | ||
################################################################################ | ||
|
||
if __name__ == "__main__": | ||
|
||
rootdir = './docs' | ||
dir_tree = dir_to_dict(rootdir) | ||
yaml_dir_tree = yaml.dump(dir_tree) | ||
print(yaml_dir_tree) | ||
|
||
# with open(mkdocs_config_file) as config_file: | ||
# mkdocs_config = yaml.full_load(config_file) | ||
|
||
# with open(mkdocs_config_file, "w") as config_file: | ||
# config_dump = yaml.dump(mkdocs_config, config_file) |
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,66 @@ | ||
################################################################################ | ||
# mkdocs Settings | ||
# See: https://www.mkdocs.org/user-guide/configuration/ | ||
################################################################################ | ||
|
||
site_name: webqueue2 API | ||
repo_url: https://github.itap.purdue.edu/ECN/webqueue2 | ||
plugins: | ||
- search | ||
markdown_extensions: | ||
- toc: | ||
permalink: ⚓︎ | ||
- admonition | ||
- pymdownx.details | ||
- pymdownx.superfences | ||
- pymdownx.highlight: | ||
use_pygments: false | ||
- pymdownx.inlinehilite | ||
- pymdownx.tabbed | ||
- pymdownx.emoji: | ||
emoji_index: !!python/name:materialx.emoji.twemoji | ||
emoji_generator: !!python/name:materialx.emoji.to_svg | ||
- mkautodoc | ||
|
||
|
||
|
||
################################################################################ | ||
# Material for mkdocs Settings | ||
# See: https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/ | ||
################################################################################ | ||
|
||
# TODO: Implement offline search | ||
# See: https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-search/#offline-search | ||
# TODO: Implement versioning | ||
# See: https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/#versioning | ||
|
||
theme: | ||
name: material | ||
palette: | ||
# Used to toggle dark mode. | ||
# scheme: slate | ||
primary: deep purple | ||
accent: teal | ||
icon: | ||
logo: material/book-open | ||
# The favicon is symlinked from the ReactJS public folder | ||
favicon: images/favicon.ico | ||
features: | ||
- navigation.sections | ||
|
||
extra: | ||
social: | ||
- icon: fontawesome/brands/slack | ||
link: https://purdueecn.slack.com/archives/C019K7PSPNW | ||
name: webqueue2 on Slack | ||
- icon: fontawesome/brands/github | ||
link: https://github.itap.purdue.edu/ECN/webqueue2 | ||
name: webqueue2 on GitHub | ||
|
||
extra_javascript: | ||
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js | ||
- javascript/highlight.js | ||
- https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js | ||
- javascript/tablesort.js | ||
extra_css: | ||
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css |