Skip to content

Commit

Permalink
Generate requirements markdown with inclusion in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robtaylor committed Oct 7, 2024
1 parent 0014cd6 commit 2947607
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
17 changes: 12 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
version: 2

build:
os: ubuntu-22.04
os: "ubuntu-22.04"
tools:
python: "3.9"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install

mkdocs:
configuration: mkdocs.yml

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions docs/gen_reqs.py
Original file line number Diff line number Diff line change
@@ -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))
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ theme: readthedocs

markdown_extensions:
- admonition
use_directory_urls: false
hooks:
- docs/gen_reqs.py

nav:
- Home: index.md
Expand All @@ -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
Expand Down

0 comments on commit 2947607

Please sign in to comment.