Skip to content

Commit

Permalink
cleanup index page
Browse files Browse the repository at this point in the history
  • Loading branch information
nelliemckesson committed Aug 5, 2024
1 parent 6addf99 commit 7b40865
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ $(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen
# create the sdk introduction
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/indexpage.xml -c > $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
python3 $(SCRIPTS_DIR)/postprocess_doxygen_adoc.py $(ASCIIDOC_DOXYGEN_DIR)/all_groups.adoc $(ASCIIDOC_DOXYGEN_DIR)
python3 $(SCRIPTS_DIR)/postprocess_doxygen_adoc.py $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc $(ASCIIDOC_DOXYGEN_DIR)
-cp $(DOXYGEN_XML_DIR)/*.png $(ASCIIDOC_DOXYGEN_DIR)

build_doxygen_adoc: $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
Expand Down
2 changes: 1 addition & 1 deletion doxygentoasciidoc
17 changes: 16 additions & 1 deletion scripts/postprocess_doxygen_adoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
import os
import json

def cleanup_index_page(adoc_file, output_adoc_path):
script_path = os.path.realpath(__file__)
top_dir_path = re.sub(r'/scripts/.*$', "", script_path)
output_path = os.path.join(top_dir_path, output_adoc_path, "index_doxygen.adoc")
with open(adoc_file) as f:
adoc_content = f.read()
# remove any errant spaces before anchors
adoc_content = re.sub(r'( +)(\[\[[^[]*?\]\])', "\\2", adoc_content)
with open(adoc_file, 'w') as f:
f.write(adoc_content)
return

def build_json(sections, output_path):
json_path = os.path.join(output_path, "picosdk_index.json")
with open(json_path, 'w') as f:
Expand Down Expand Up @@ -96,4 +108,7 @@ def postprocess_doxygen_adoc(adoc_file, output_adoc_path):
if __name__ == '__main__':
adoc_file = sys.argv[1]
output_adoc_path = sys.argv[2]
postprocess_doxygen_adoc(adoc_file, output_adoc_path)
if re.search("index_doxygen.adoc", adoc_file) is not None:
cleanup_index_page(adoc_file, output_adoc_path)
else:
postprocess_doxygen_adoc(adoc_file, output_adoc_path)

0 comments on commit 7b40865

Please sign in to comment.