forked from deephaven/deephaven-plugins
-
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
69 changed files
with
1,495 additions
and
638 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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,45 +1,79 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import contextlib | ||
from typing import IO, Generator | ||
|
||
BUILT_DOCS = "docs/build/markdown" | ||
|
||
# save original directory so we can return to it | ||
cwd = os.getcwd() | ||
|
||
# change to the directory of this file | ||
dirname = os.path.dirname(__file__) | ||
os.chdir(dirname) | ||
@contextlib.contextmanager | ||
def pushd() -> None: | ||
""" | ||
Change to the script directory, and return to the original directory when done. | ||
""" | ||
# save original directory so we can return to it | ||
cwd = os.getcwd() | ||
|
||
os.system("make clean") | ||
# change to the directory of this file | ||
dirname = os.path.dirname(__file__) | ||
if dirname: | ||
os.chdir(dirname) | ||
|
||
print("Building markdown") | ||
os.system("make markdown") | ||
try: | ||
yield | ||
finally: | ||
# ensure we always return to the original directory, even if an exception is raised | ||
os.chdir(cwd) | ||
|
||
print("Copying assets") | ||
os.system(f"cp -r docs/_assets {BUILT_DOCS}/_assets") | ||
os.system(f"cp docs/sidebar.json {BUILT_DOCS}/sidebar.json") | ||
|
||
os.system(f"rm {BUILT_DOCS}/index.md") | ||
def md_files() -> Generator[str, None, None]: | ||
""" | ||
Walk the built docs directory and yield the path to each markdown file. | ||
try: | ||
# go through each markdown file, look for ### deephaven.plot.express then add the syntax block | ||
Returns: | ||
Generator[str, None, None]: The path to each markdown file. | ||
""" | ||
for root, dirs, files in os.walk(BUILT_DOCS): | ||
for file in files: | ||
if file.endswith(".md"): | ||
with open(os.path.join(root, file), "r") as f: | ||
lines = f.readlines() | ||
with open(os.path.join(root, file), "w") as f: | ||
for line in lines: | ||
if "### deephaven.plot.express." in line: | ||
# remove escaped \* with * as it's not needed when in a code block | ||
line = line.replace("\\*", "*") | ||
# first add the lines here | ||
line = line.replace("### deephaven.plot.express.", "") | ||
before = "<Syntax>\n\n```python\n" | ||
after = "```\n\n</Syntax>\n" | ||
line = before + line + after | ||
# then here | ||
f.write(line) | ||
|
||
finally: | ||
# ensure we always return to the original directory, even if an exception is raised | ||
os.chdir(cwd) | ||
yield os.path.join(root, file) | ||
|
||
|
||
def md_lines() -> Generator[tuple[IO, str], None, None]: | ||
""" | ||
Open each markdown file and yield the file object and each line in the file. | ||
Returns: | ||
Generator[tuple[IO, str], None, None]: The file object and each line in the file. | ||
""" | ||
for file in md_files(): | ||
with open(file, "r") as f: | ||
lines = f.readlines() | ||
with open(file, "w") as f: | ||
for line in lines: | ||
yield f, line | ||
|
||
|
||
with pushd(): | ||
os.system("make clean") | ||
|
||
print("Building markdown") | ||
os.system("make markdown") | ||
|
||
print("Copying assets") | ||
os.system(f"cp -r docs/_assets {BUILT_DOCS}/_assets") | ||
os.system(f"cp docs/sidebar.json {BUILT_DOCS}/sidebar.json") | ||
|
||
os.system(f"rm {BUILT_DOCS}/index.md") | ||
|
||
for f, line in md_lines(): | ||
if line.startswith("<!-- <ParamTable param={{") and line.endswith( | ||
"}} /> -->\n" | ||
): | ||
# remove the comment markers | ||
# these are added in deephaven_autodoc.py to prevent special characters from being escaped | ||
# by the markdown renderer | ||
line = line.replace("<!-- ", "") | ||
line = line.replace(" -->", "") | ||
f.write(line) |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
deephaven-server | ||
Sphinx | ||
myst-parser | ||
sphinx-markdown-builder | ||
sphinx-autodoc-typehints | ||
typing_extensions;python_version<'3.11' |
Oops, something went wrong.