From 7f96f3f1b4166a9bae255d70a776d7f6ebe9e28e Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Mon, 16 Oct 2023 12:34:35 +0000 Subject: [PATCH 1/3] 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 %} -- 2.34.1 From daa55049c77256d5e35ee945e902f3ff933e12ff Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Tue, 24 Oct 2023 07:56:05 +0000 Subject: [PATCH 2/3] Made tox.ini smaller --- otc_metadata/templates/tox.ini.j2 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/otc_metadata/templates/tox.ini.j2 b/otc_metadata/templates/tox.ini.j2 index fdfe8260..8f5afbd4 100644 --- a/otc_metadata/templates/tox.ini.j2 +++ b/otc_metadata/templates/tox.ini.j2 @@ -68,19 +68,9 @@ allowlist_externals = mkdir commands = 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 %} + sphinx-minify --input-directory doc/build/html_temp/{{ doc.type }} --output-directory doc/build/html/{{ doc.type }} + mkdir -p {{ doc.type }}/build/html + cp -av doc/build/html/{{ doc.type }} {{ doc.type }}/build/html # Json version (for search) [testenv:json-{{ doc.type }}] -- 2.34.1 From 39afa1066296730e4efd9ade26add68a18ae4a20 Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Tue, 24 Oct 2023 09:03:32 +0000 Subject: [PATCH 3/3] JSON changes --- otc_metadata/templates/tox.ini.j2 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/otc_metadata/templates/tox.ini.j2 b/otc_metadata/templates/tox.ini.j2 index 8f5afbd4..bf20f477 100644 --- a/otc_metadata/templates/tox.ini.j2 +++ b/otc_metadata/templates/tox.ini.j2 @@ -84,16 +84,8 @@ commands = # Drop data useless for the search - wrap it also with sh/xargs due to bugs # in tox sh -c "find doc/build/json -type d -and '(' -name '_images' -or -name '_static' -or -name '_sources' ')' -print0 | xargs -0 rm -rf" -{%- if doc.type == 'api-ref' %} - mkdir -p api-ref/build/json - cp -av doc/build/json/api-ref api-ref/build/json -{%- elif doc.type == 'umn' %} - mkdir -p umn/build/json - cp -av doc/build/json/umn umn/build/json -{%- elif doc.type == 'dev-guide' %} - mkdir -p dev_guide/build/json - cp -av doc/build/json/dev-guide dev_guide/build/json -{%- endif %} + mkdir -p {{ doc.type }}/build/json + cp -av doc/build/json/{{ doc.type }} {{ doc.type }}/build/json {% if doc.pdf_name -%} # PDF version -- 2.34.1