From ccad9617d35392c2d79e33b52abd1a03e0a1ffbe Mon Sep 17 00:00:00 2001 From: "Gode, Sebastian" Date: Tue, 14 Nov 2023 13:47:45 +0000 Subject: [PATCH] Update tox.ini && conf.py file Reviewed-by: tischrei Co-authored-by: Gode, Sebastian Co-committed-by: Gode, Sebastian --- doc/requirements.txt | 3 ++ doc/source/conf.py | 4 +- tox.ini | 112 +++++++++++++++++++++++-------------------- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index ea0c4de..c022286 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,7 +1,10 @@ sphinx>=2.0.0,!=2.1.0 # BSD + otcdocstheme # Apache-2.0 + # releasenotes 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/doc/source/conf.py b/doc/source/conf.py index f937988..c14e24f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -36,8 +36,8 @@ otcdocs_doc_environment = '' otcdocs_doc_link = '' otcdocs_doc_title = '' otcdocs_doc_type = '' -otcdocs_service_category = '' -otcdocs_service_title = '' +otcdocs_service_category = 'security-services' +otcdocs_service_title = 'Dedicated Web Application Firewall' otcdocs_service_type = 'wafd' otcdocs_search_environment = 'hc_de' otcdocs_search_url = "https://opensearch.eco.tsi-dev.otc-service.com/" diff --git a/tox.ini b/tox.ini index f7d5347..7d251b6 100644 --- a/tox.ini +++ b/tox.ini @@ -34,14 +34,15 @@ 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 - {[testenv:api-ref]commands} - {[testenv:json-api-ref]commands} + 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 {[testenv:umn]commands} {[testenv:json-umn]commands} {[testenv:best-practice]commands} {[testenv:json-best-practice]commands} + {[testenv:api-ref]commands} + {[testenv:json-api-ref]commands} [testenv:docs-pdf] deps = {[testenv:docs]deps} @@ -53,54 +54,9 @@ allowlist_externals = cp commands = mkdir -p doc/build/pdf - {[testenv:api-ref-pdf-docs]commands} {[testenv:umn-pdf-docs]commands} {[testenv:best-practice-pdf-docs]commands} - - -# HTML version -[testenv:api-ref] -deps = {[testenv:docs]deps} -allowlist_externals = - cp - mkdir -commands = - sphinx-build -W --keep-going -b html api-ref/source doc/build/html/api-ref - mkdir -p api-ref/build/html - cp -av doc/build/html/api-ref api-ref/build/html - -# Json version (for search) -[testenv:json-api-ref] -deps = {[testenv:docs]deps} -allowlist_externals = - cp - mkdir - sh -commands = - sphinx-build -W --keep-going -b json api-ref/source doc/build/json/api-ref - # 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" - mkdir -p api-ref/build/json - cp -av doc/build/json/api-ref api-ref/build/json - -# PDF version -[testenv:api-ref-pdf-docs] -deps = {[testenv:docs]deps} -allowlist_externals = - rm - mkdir - make - bash - cp -commands = - rm -rf api-ref/build/pdf - sphinx-build -W --keep-going -b latex api-ref/source api-ref/build/pdf/ - bash -c "for f in api-ref/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" - bash -c "for f in api-ref/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" - make -C api-ref/build/pdf - mkdir -p doc/build/pdf - cp api-ref/build/pdf/wafd-api-ref.pdf doc/build/pdf/ + {[testenv:api-ref-pdf-docs]commands} # HTML version @@ -110,7 +66,8 @@ allowlist_externals = cp mkdir commands = - sphinx-build -W --keep-going -b html umn/source doc/build/html/umn + sphinx-build -W --keep-going -b html umn/source doc/build/html_temp/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 @@ -155,7 +112,10 @@ allowlist_externals = cp mkdir commands = - sphinx-build -W --keep-going -b html doc/best-practice/source doc/build/html/best-practice + sphinx-build -W --keep-going -b html doc/best-practice/source doc/build/html_temp/best-practice + sphinx-minify --input-directory doc/build/html_temp/best-practice --output-directory doc/build/html/best-practice + mkdir -p best-practice/build/html + cp -av doc/build/html/best-practice best-practice/build/html # Json version (for search) [testenv:json-best-practice] @@ -169,6 +129,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" + mkdir -p best-practice/build/json + cp -av doc/build/json/best-practice best-practice/build/json # PDF version [testenv:best-practice-pdf-docs] @@ -189,6 +151,52 @@ commands = cp doc/best-practice/build/pdf/wafd-best-practice.pdf doc/build/pdf/ +# HTML version +[testenv:api-ref] +deps = {[testenv:docs]deps} +allowlist_externals = + cp + mkdir +commands = + sphinx-build -W --keep-going -b html api-ref/source doc/build/html_temp/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 + +# Json version (for search) +[testenv:json-api-ref] +deps = {[testenv:docs]deps} +allowlist_externals = + cp + mkdir + sh +commands = + sphinx-build -W --keep-going -b json api-ref/source doc/build/json/api-ref + # 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" + mkdir -p api-ref/build/json + cp -av doc/build/json/api-ref api-ref/build/json + +# PDF version +[testenv:api-ref-pdf-docs] +deps = {[testenv:docs]deps} +allowlist_externals = + rm + mkdir + make + bash + cp +commands = + rm -rf api-ref/build/pdf + sphinx-build -W --keep-going -b latex api-ref/source api-ref/build/pdf/ + bash -c "for f in api-ref/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" + bash -c "for f in api-ref/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" + make -C api-ref/build/pdf + mkdir -p doc/build/pdf + cp api-ref/build/pdf/wafd-api-ref.pdf doc/build/pdf/ + + [doc8] ignore = D001