Skip to content

Commit

Permalink
fix: merge intake_by_uuid and modules_by_uuid plugins into a single o…
Browse files Browse the repository at this point in the history
…n_page_read_source hook (as mkdocs forbids multiple on_page_read_source hooks)
  • Loading branch information
jeromefellus-sekoia committed Nov 15, 2024
1 parent 336d6a9 commit fffb359
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions plugins/integration_by_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fffb359

Please sign in to comment.