From 7f96f3f1b4166a9bae255d70a776d7f6ebe9e28e Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Mon, 16 Oct 2023 12:34:35 +0000 Subject: [PATCH] Added sphinx-minify to tox --- otc_metadata/templates/doc_requirements.txt.j2 | 1 + otc_metadata/templates/tox.ini.j2 | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/otc_metadata/templates/doc_requirements.txt.j2 b/otc_metadata/templates/doc_requirements.txt.j2 index ea0c4dee..bbd02623 100644 --- a/otc_metadata/templates/doc_requirements.txt.j2 +++ b/otc_metadata/templates/doc_requirements.txt.j2 @@ -4,4 +4,5 @@ otcdocstheme # Apache-2.0 reno>=3.1.0 # Apache-2.0 otc-sphinx-directives>=0.1.0 +sphinx-minify>=0.0.1 # Apache-2.0 git+https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata.git#egg=otc_metadata \ No newline at end of file diff --git a/otc_metadata/templates/tox.ini.j2 b/otc_metadata/templates/tox.ini.j2 index ce1b265a..fdfe8260 100644 --- a/otc_metadata/templates/tox.ini.j2 +++ b/otc_metadata/templates/tox.ini.j2 @@ -34,8 +34,9 @@ allowlist_externals = rm sphinx-build commands = - rm -rf doc/build/html doc/build/doctrees - sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html + rm -rf doc/build/html doc/build/html_temp doc/build/doctrees + sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html_temp + sphinx-minify --input-directory doc/build/html_temp/ --output-directory doc/build/html {%- for doc in docs %} {[testenv:{{ doc.type }}]commands} {[testenv:json-{{ doc.type }}]commands} @@ -66,14 +67,17 @@ allowlist_externals = cp mkdir commands = - sphinx-build -W --keep-going -b html {{ loc }}/source doc/build/html/{{ doc.type }} + sphinx-build -W --keep-going -b html {{ loc }}/source doc/build/html_temp/{{ doc.type }} {%- if doc.type == 'api-ref' %} + sphinx-minify --input-directory doc/build/html_temp/api-ref --output-directory doc/build/html/api-ref mkdir -p api-ref/build/html cp -av doc/build/html/api-ref api-ref/build/html {%- elif doc.type == 'umn' %} + sphinx-minify --input-directory doc/build/html_temp/umn --output-directory doc/build/html/umn mkdir -p umn/build/html cp -av doc/build/html/umn umn/build/html {%- elif doc.type == 'dev-guide' %} + sphinx-minify --input-directory doc/build/html_temp/dev-guide --output-directory doc/build/html/dev-guide mkdir -p dev_guide/build/html cp -av doc/build/html/dev-guide dev_guide/build/html {%- endif %}