From 64d2fdb977134f40b075b00d64b74e576ac09d3f Mon Sep 17 00:00:00 2001 From: Niels Henrik Hagen Date: Tue, 16 Apr 2024 00:49:47 +0200 Subject: [PATCH] feat: Display the authors of a TechDocs file --- images/techdocs/context/Makefile | 4 ++-- images/techdocs/context/mkdocs.yml | 4 ++++ images/techdocs/context/requirements-techdocs.in | 1 + images/techdocs/context/requirements-techdocs.txt | 10 +++++++++- images/techdocs/tests/test_image.py | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/images/techdocs/context/Makefile b/images/techdocs/context/Makefile index 591abcd36..5a7abf20e 100644 --- a/images/techdocs/context/Makefile +++ b/images/techdocs/context/Makefile @@ -98,12 +98,12 @@ mkdocs.yml: /usr/local/share/techdocs/mkdocs.yml .PHONY: build build: mkdocs.yml ## Build the website - export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && techdocs-cli generate --no-docker + export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && export AUTHORS=$(AUTHORS) && techdocs-cli generate --no-docker ENTITY := $(shell yq --no-doc 'select(document_index == 0) | [.metadata.namespace // "default", .kind, .metadata.name] | join("/")' ./catalog-info.yaml) serve: mkdocs.yml ## Run a preview site - export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && techdocs-cli serve --no-docker + export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && export AUTHORS=$(AUTHORS) && techdocs-cli serve --no-docker .PHONY: publish publish: site ## Publish the website to the TechDocs Bucket diff --git a/images/techdocs/context/mkdocs.yml b/images/techdocs/context/mkdocs.yml index 08d8bdc85..2c293a04d 100644 --- a/images/techdocs/context/mkdocs.yml +++ b/images/techdocs/context/mkdocs.yml @@ -4,6 +4,10 @@ repo_url: !ENV [REPO_URL, null] edit_uri: !ENV [EDIT_URI, null] plugins: - techdocs-core + - git-committers: + enabled: !ENV [AUTHORS, true] + repository: !ENV REPO_NAME + branch: main - htmlproofer: validate_external_urls: false - git-revision-date-localized: diff --git a/images/techdocs/context/requirements-techdocs.in b/images/techdocs/context/requirements-techdocs.in index 89a76921a..02c6ca7a5 100644 --- a/images/techdocs/context/requirements-techdocs.in +++ b/images/techdocs/context/requirements-techdocs.in @@ -1,5 +1,6 @@ mkdocs-awesome-pages-plugin==2.9.2 mkdocs-ezlinks-plugin==0.1.14 +mkdocs-git-committers-plugin-2==0.3.0 mkdocs-git-revision-date-localized-plugin==1.2.4 mkdocs-htmlproofer-plugin==1.2.0 mkdocs-kroki-plugin==0.7.1 diff --git a/images/techdocs/context/requirements-techdocs.txt b/images/techdocs/context/requirements-techdocs.txt index 23ddca860..7c6bf9f63 100644 --- a/images/techdocs/context/requirements-techdocs.txt +++ b/images/techdocs/context/requirements-techdocs.txt @@ -133,7 +133,9 @@ gitdb==4.0.11 \ gitpython==3.1.43 \ --hash=sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c \ --hash=sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff - # via mkdocs-git-revision-date-localized-plugin + # via + # mkdocs-git-committers-plugin-2 + # mkdocs-git-revision-date-localized-plugin idna==3.7 \ --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 @@ -238,6 +240,7 @@ mkdocs==1.5.3 \ # via # mkdocs-awesome-pages-plugin # mkdocs-ezlinks-plugin + # mkdocs-git-committers-plugin-2 # mkdocs-git-revision-date-localized-plugin # mkdocs-htmlproofer-plugin # mkdocs-kroki-plugin @@ -252,6 +255,10 @@ mkdocs-awesome-pages-plugin==2.9.2 \ mkdocs-ezlinks-plugin==0.1.14 \ --hash=sha256:3e2085c16a850e022393e80194c17612e7b55de87fb45b3ffb618b5dfdb10811 # via -r requirements-techdocs.in +mkdocs-git-committers-plugin-2==0.3.0 \ + --hash=sha256:53e8ad142f4da2601ad676847fd0fcf00924fb778e61d2d559f6ce89add8b663 \ + --hash=sha256:6aed7b3fee1da445799da4340ae8cf5bc71b43357f177119b0c447b8dca022d8 + # via -r requirements-techdocs.in mkdocs-git-revision-date-localized-plugin==1.2.4 \ --hash=sha256:08fd0c6f33c8da9e00daf40f7865943113b3879a1c621b2bbf0fa794ffe997d3 \ --hash=sha256:1f94eb510862ef94e982a2910404fa17a1657ecf29f45a07b0f438c00767fc85 @@ -566,6 +573,7 @@ requests==2.31.0 \ --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 # via + # mkdocs-git-committers-plugin-2 # mkdocs-htmlproofer-plugin # mkdocs-kroki-plugin # mkdocs-material diff --git a/images/techdocs/tests/test_image.py b/images/techdocs/tests/test_image.py index 39339ec32..b90dbd6b2 100644 --- a/images/techdocs/tests/test_image.py +++ b/images/techdocs/tests/test_image.py @@ -155,7 +155,7 @@ def test_build( ) -> None: actual_output = docker_client.containers.run( build_image.id, - command='build REPO_NAME=example/test REPO_URL="http://github.com/example/test" EDIT_URL="edit/main/docs"', + command='build REPO_NAME=example/test REPO_URL="http://github.com/example/test" EDIT_URL="edit/main/docs" AUTHORS=false', volumes=volumes, remove=True, )