diff --git a/Makefile b/Makefile index 1acdff05ff..22e9feb2d4 100644 --- a/Makefile +++ b/Makefile @@ -62,9 +62,9 @@ clean_submodules: # Create the pico-sdk Doxygen XML files $(DOXYGEN_XML_DIR) $(DOXYGEN_XML_DIR)/index.xml: | $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_PICO_SDK_BUILD_DIR) - cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs - cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040 - cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350 + cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs + cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040 + cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350 $(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined docs $(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 docs $(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 docs diff --git a/scripts/create_build_adoc_doxygen.py b/scripts/create_build_adoc_doxygen.py index 60cb5e33c2..e1a806cb47 100755 --- a/scripts/create_build_adoc_doxygen.py +++ b/scripts/create_build_adoc_doxygen.py @@ -16,9 +16,8 @@ def check_no_markdown(filename): asciidoc = re.sub(r'----\n.*?\n----', '', asciidoc, flags=re.DOTALL) # strip out pass-through blocks asciidoc = re.sub(r'\+\+\+\+\n.*?\n\+\+\+\+', '', asciidoc, flags=re.DOTALL) - # This is messing up the c code blocks - # if re.search(r'(?:^|\n)#+', asciidoc): - # raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename)) + if re.search(r'(?:^|\n)#+', asciidoc): + raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename)) if re.search(r'(\[.+?\]\(.+?\))', asciidoc): raise Exception("{} contains a Markdown-style link (i.e. '[title](url)' rather than 'url[title]')".format(filename)) diff --git a/scripts/postprocess_doxygen_xml.py b/scripts/postprocess_doxygen_xml.py index b2ae893142..9af2131eec 100755 --- a/scripts/postprocess_doxygen_xml.py +++ b/scripts/postprocess_doxygen_xml.py @@ -3,7 +3,7 @@ import sys import re import os -import html +#import html from bs4 import BeautifulSoup # walk the combined output. @@ -18,30 +18,31 @@ def compile_id_list(xml_content): id_list = [x["id"] for x in els] return id_list -def insert_example_code_from_file(combined_content): - els = combined_content.doxygen.find_all("programlisting") - all_examples = {} - # get the examples path - examples_path = re.sub(r"/scripts/.+$", "/lib/pico-examples", os.path.realpath(__file__)) - # get a recursive list of all files in examples - for f in os.walk(examples_path): - for filename in f[2]: - if filename in all_examples: - all_examples[filename].append(os.path.join(f[0], filename)) - else: - all_examples[filename] = [os.path.join(f[0], filename)] - for el in els: - if el.get("filename") is not None: - filename = el.get("filename") - # find the file here or in examples - if filename in all_examples: - with open(all_examples[filename][0]) as f: - example_content = f.read() - example_lines = example_content.split("\n") - for line in example_lines: - codeline = BeautifulSoup(""+html.escape(line)+"", 'xml') - el.append(codeline) - return combined_content +# Unused code - but kept in case we need it in future +#def insert_example_code_from_file(combined_content): +# els = combined_content.doxygen.find_all("programlisting") +# all_examples = {} +# # get the examples path +# examples_path = re.sub(r"/scripts/.+$", "/lib/pico-examples", os.path.realpath(__file__)) +# # get a recursive list of all files in examples +# for f in os.walk(examples_path): +# for filename in f[2]: +# if filename in all_examples: +# all_examples[filename].append(os.path.join(f[0], filename)) +# else: +# all_examples[filename] = [os.path.join(f[0], filename)] +# for el in els: +# if el.get("filename") is not None: +# filename = el.get("filename") +# # find the file here or in examples +# if filename in all_examples: +# with open(all_examples[filename][0]) as f: +# example_content = f.read() +# example_lines = example_content.split("\n") +# for line in example_lines: +# codeline = BeautifulSoup(""+html.escape(line)+"", 'xml') +# el.append(codeline) +# return combined_content def walk_and_tag_xml_tree(el, output_contexts, all_contexts): """ @@ -123,7 +124,8 @@ def postprocess_doxygen_xml_file(combined_xmlfile, xmlfiles, output_context_path els = combined_content.doxygen.find_all(True, recursive=False) for el in els: walk_and_tag_xml_tree(el, output_contexts, list(output_context_paths.keys())) - combined_content = insert_example_code_from_file(combined_content) + # I think this was only needed because the PICO_EXAMPLES_PATH was wrong in the Makefile + #combined_content = insert_example_code_from_file(combined_content) return str(combined_content) def postprocess_doxygen_xml(xml_path):