Skip to content

Commit

Permalink
Documentation genertation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Dudnytskyi committed Sep 13, 2024
1 parent 39a017a commit d221227
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/script/make_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def process_section(section, output_file, pth):
output_file_name = sys.argv[1]
output_file = open(output_file_name, "w")
output_file.writelines(document_header)
see_also_lines = []

for in_f in doc_file_path:
print(f"Processing: {in_f}")
output_file.write(f".. Generated from {in_f}\n\n")
Expand All @@ -90,12 +92,18 @@ def process_section(section, output_file, pth):
lines = input_file.readlines()
is_seo = False
is_section = False
is_in_see_also = False
section = []
l_counter = 0
for line in lines:
l_counter += 1
if line == "See Also\n":
break
is_in_see_also = True
continue
if is_in_see_also:
if line.startswith('- '):
see_also_lines.append(process_esphome_refs(line.rstrip(), l_counter))
continue
if is_section:
if (line in ['\n', '\r\n']) or line.startswith(" "):
section.append(line)
Expand All @@ -116,4 +124,6 @@ def process_section(section, output_file, pth):
continue
l = process_esphome_refs(line, l_counter)
output_file.write(l)
print(f"\tProcessed {l_counter} line(s)")
print(f"\tProcessed {l_counter} line(s)")
print("Processing See Also section")
print(see_also_lines)

0 comments on commit d221227

Please sign in to comment.