From 88fd137f21c56bb3eda6edefa6cf7bb729c1d198 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 29 Sep 2024 20:53:08 -0400 Subject: [PATCH] Generate requirements markdown with inclusion in docs --- Makefile | 2 +- docs/gen_reqs.py | 15 +++++++++++++++ mkdocs.yml | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 docs/gen_reqs.py diff --git a/Makefile b/Makefile index e09db7e4e..c8c74f89c 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ docs/gen/*.tex: $(YAML) .PHONY: reqs-md reqs-md: install docs/gen/*.md docs/gen/*.md: $(YAML) - $(DOORSTOP) publish all docs/gen --markdown + $(DOORSTOP) publish all docs/gen --markdown --index .PHONY: reqs-pdf reqs-pdf: reqs-latex diff --git a/docs/gen_reqs.py b/docs/gen_reqs.py new file mode 100644 index 000000000..24f4184ca --- /dev/null +++ b/docs/gen_reqs.py @@ -0,0 +1,15 @@ +import os + +from doorstop.core import publisher, builder +from doorstop.cli import utilities + + +def on_pre_build(config): + cwd = os.getcwd() + path = os.path.abspath(os.path.join(cwd, "docs/gen")) + tree = builder.build(cwd=cwd) + + published_path = publisher.publish(tree, path, ".md", index=True) + + if published_path: + utilities.show("published: {}".format(published_path)) diff --git a/mkdocs.yml b/mkdocs.yml index 750a9d3a0..0c21d5017 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -9,6 +9,9 @@ theme: readthedocs markdown_extensions: - admonition +use_directory_urls: false +hooks: + - docs/gen_reqs.py nav: - Home: index.md @@ -25,6 +28,7 @@ nav: - Desktop Interface: gui/overview.md - Web Interface: web.md - Scripting Interface: api/scripting.md +- Doorstop's requirements: gen/index.md - Reference: - Tree: reference/tree.md - Document: reference/document.md