From bc9e56a8600e79f5fb3b3baa3c8d5da03cf039ae Mon Sep 17 00:00:00 2001 From: R Kent James Date: Fri, 19 Apr 2024 13:30:40 -0700 Subject: [PATCH] add package.xml to standard documents (#115) --- rosdoc2/verbs/build/standard_documents.py | 9 ++++++++- test/test_builder.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rosdoc2/verbs/build/standard_documents.py b/rosdoc2/verbs/build/standard_documents.py index 06ebaa3..286d382 100644 --- a/rosdoc2/verbs/build/standard_documents.py +++ b/rosdoc2/verbs/build/standard_documents.py @@ -37,7 +37,7 @@ def locate_standard_documents(package_xml_directory): """Locate standard documents.""" - names = ['readme', 'license', 'contributing', 'changelog', 'quality_declaration'] + names = ['readme', 'license', 'contributing', 'changelog', 'quality_declaration', 'package'] found_paths = {} package_directory_items = os.scandir(package_xml_directory) for item in package_directory_items: @@ -53,6 +53,10 @@ def locate_standard_documents(package_xml_directory): filetype = 'md' elif ext.lower() == '.rst': filetype = 'rst' + elif ext.lower() == '.xml': + if item.name != 'package.xml': + continue + filetype = 'xml' else: filetype = 'other' found_paths[name] = { @@ -91,6 +95,9 @@ def generate_standard_document_files(standard_docs, wrapped_sphinx_directory): elif file_type == 'md': file_contents += f'.. include:: {file_path}\n' file_contents += ' :parser: myst_parser.sphinx_\n' + elif file_type == 'xml': + file_contents += f'.. literalinclude:: {file_path}\n' + file_contents += ' :language: xml\n' else: file_contents += f'.. literalinclude:: {file_path}\n' file_contents += ' :language: none\n' diff --git a/test/test_builder.py b/test/test_builder.py index b0d4353..522d234 100644 --- a/test/test_builder.py +++ b/test/test_builder.py @@ -228,6 +228,7 @@ def test_full_package(session_dir): 'user_docs/morestuff/more_of_more/subsub.html', # a deep documentation file 'standards.html', 'https://example.com/repo', + 'standard_docs/PACKAGE.html', # package.xml ] excludes = [ 'dontshowme'