From fffb359f67c4fdd479e60daa5ba2c793b0b3281a Mon Sep 17 00:00:00 2001 From: Jerome Fellus Date: Fri, 15 Nov 2024 12:22:57 +0100 Subject: [PATCH] fix: merge intake_by_uuid and modules_by_uuid plugins into a single on_page_read_source hook (as mkdocs forbids multiple on_page_read_source hooks) --- mkdocs.yml | 1 + plugins/integration_by_uuid.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index a727410a36..2bdb7cebd2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -663,6 +663,7 @@ plugins: xdr/features/investigate/dork_language.md: xdr/features/investigate/events_query_language.md - redoc - integration_by_uuid +- sass repo_url: https://github.com/SEKOIA-IO/documentation site_name: Sekoia.io Documentation site_url: https://docs.sekoia.io diff --git a/plugins/integration_by_uuid.py b/plugins/integration_by_uuid.py index a6d6663251..5abd49688e 100644 --- a/plugins/integration_by_uuid.py +++ b/plugins/integration_by_uuid.py @@ -95,13 +95,15 @@ def on_files(self, files: Files, config: Config): source_file for source_file in files if source_file.src_path.endswith(".md") ] - for source_file in files: - if not source_file.src_path.endswith(".md"): - continue - - filename = Path(config["docs_dir"]) / Path(source_file.src_path) - with filename.open() as f: - _, metadata = get_data(f.read()) + for dialect_uuid in dialect_uuids: + self._redirection_table[dialect_uuid] = source_file.url + self._integrations.append( + { + "uuid": dialect_uuid, + "name": metadata.get("name"), + "destination": source_file.url, + } + ) if "uuid" not in metadata: continue