Skip to content

Commit

Permalink
Another directory change
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Damiano <[email protected]>
  • Loading branch information
SRGDamia1 committed Aug 13, 2024
1 parent 483d521 commit 234ab69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/copyFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from bs4 import BeautifulSoup

# %%
# Some working directories

# The workspace directory
if "GITHUB_WORKSPACE" in os.environ.keys() and "DOC_ROOT" in os.environ.keys():
docbuild_dir = os.environ.get("DOC_ROOT")
Expand Down
13 changes: 8 additions & 5 deletions docs/documentExamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,41 @@
# %%
# Find all of the examples in the examples folder, append the path "examples" to it
examples_to_doc = [
f"{examples_path}\\{f}\\{f}.ino"
os.path.abspath(os.path.realpath(f"{examples_path}\\{f}\\{f}.ino"))
for f in os.listdir(examples_path)
if os.path.isdir(os.path.join(examples_path, f))
and f not in [".history", "logger_test", "menu_a_la_carte"]
]
examples_to_doc += [
f"{extras_path}\\{f}\\{f}.ino"
os.path.abspath(os.path.realpath(f"{extras_path}\\{f}\\{f}.ino"))
for f in os.listdir(extras_path)
if os.path.isdir(os.path.join(extras_path, f))
and f not in [".history", "logger_test", "menu_a_la_carte"]
]
print("Examples to document:")
print(" ", end="")
print("\n ".join(examples_to_doc))

# %%
with open(output_file, "w+") as out_file:
for filename in examples_to_doc:
print(filename)
print(f"\nCurrent example: {filename}")
with open(filename, "r") as in_file: # open in readonly mode
i = 1
got_start_comment = False
lines = in_file.readlines()
for line in lines:
if i < 3 and line.startswith("/**"):
got_start_comment = True
print(i)
print(f" First line of doc block: {i}")
if got_start_comment and (
line.startswith("*/") or line.startswith(" */")
):
out_file.write(" *\n")
out_file.write(" * @m_examplenavigation{examples_page,}\n")
out_file.write(" * @m_footernavigation\n")
out_file.write(line)
print(i)
print(f" Last line of doc block: {i}")
got_start_comment = False
if got_start_comment:
out_file.write(line)
Expand Down

0 comments on commit 234ab69

Please sign in to comment.