From fa4e76d1242f6fda758024909fd5ba40836d7547 Mon Sep 17 00:00:00 2001 From: "Gode, Sebastian" Date: Tue, 14 Nov 2023 13:22:03 +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 | 11 +++++ tox.ini | 104 +++++++++++++++++++++++-------------------- umn/source/conf.py | 7 +-- 4 files changed, 71 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 29ff415..535ce34 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -31,6 +31,17 @@ otcdocs_repo_name = 'docs/cloud-container-engine' otcdocs_git_fqdn = 'gitea.eco.tsi-dev.otc-service.com' otcdocs_git_type = 'gitea' +# Those variables are needed for indexing into OpenSearch +otcdocs_doc_environment = '' +otcdocs_doc_link = '' +otcdocs_doc_title = '' +otcdocs_doc_type = '' +otcdocs_service_category = 'container' +otcdocs_service_title = 'Cloud Container Engine' +otcdocs_service_type = 'cce' +otcdocs_search_environment = 'hc_de' +otcdocs_search_url = "https://opensearch.eco.tsi-dev.otc-service.com/" + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. diff --git a/tox.ini b/tox.ini index 7f35d71..b7372cc 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 + 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:api-ref]commands} - {[testenv:json-api-ref]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,8 +54,8 @@ allowlist_externals = cp commands = mkdir -p doc/build/pdf - {[testenv:api-ref-pdf-docs]commands} {[testenv:best-practice-pdf-docs]commands} + {[testenv:api-ref-pdf-docs]commands} # HTML version @@ -64,7 +65,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 @@ -85,6 +87,52 @@ commands = +# HTML version +[testenv:best-practice] +deps = {[testenv:docs]deps} +allowlist_externals = + cp + mkdir +commands = + 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] +deps = {[testenv:docs]deps} +allowlist_externals = + cp + mkdir + sh +commands = + sphinx-build -W --keep-going -b json doc/best-practice/source doc/build/json/best-practice + # 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] +deps = {[testenv:docs]deps} +allowlist_externals = + rm + mkdir + make + bash + cp +commands = + rm -rf doc/best-practice/build/pdf + sphinx-build -W --keep-going -b latex doc/best-practice/source doc/best-practice/build/pdf/ + bash -c "for f in doc/best-practice/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" + bash -c "for f in doc/best-practice/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" + make -C doc/best-practice/build/pdf + mkdir -p doc/build/pdf + cp doc/best-practice/build/pdf/cce-best-practice.pdf doc/build/pdf/ + + # HTML version [testenv:api-ref] deps = {[testenv:docs]deps} @@ -92,7 +140,8 @@ allowlist_externals = cp mkdir commands = - sphinx-build -W --keep-going -b html api-ref/source doc/build/html/api-ref + 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 @@ -130,47 +179,6 @@ commands = cp api-ref/build/pdf/cce-api-ref.pdf doc/build/pdf/ -# HTML version -[testenv:best-practice] -deps = {[testenv:docs]deps} -allowlist_externals = - cp - mkdir -commands = - sphinx-build -W --keep-going -b html doc/best-practice/source doc/build/html/best-practice - -# Json version (for search) -[testenv:json-best-practice] -deps = {[testenv:docs]deps} -allowlist_externals = - cp - mkdir - sh -commands = - sphinx-build -W --keep-going -b json doc/best-practice/source doc/build/json/best-practice - # 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" - -# PDF version -[testenv:best-practice-pdf-docs] -deps = {[testenv:docs]deps} -allowlist_externals = - rm - mkdir - make - bash - cp -commands = - rm -rf doc/best-practice/build/pdf - sphinx-build -W --keep-going -b latex doc/best-practice/source doc/best-practice/build/pdf/ - bash -c "for f in doc/best-practice/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" - bash -c "for f in doc/best-practice/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" - make -C doc/best-practice/build/pdf - mkdir -p doc/build/pdf - cp doc/best-practice/build/pdf/cce-best-practice.pdf doc/build/pdf/ - - [doc8] ignore = D001 diff --git a/umn/source/conf.py b/umn/source/conf.py index 548be66..4bcf330 100644 --- a/umn/source/conf.py +++ b/umn/source/conf.py @@ -109,9 +109,4 @@ html_static_path = ['_static'] html_copy_source = False # -- Options for PDF output -------------------------------------------------- -latex_documents = [ - ('index', - 'None.tex', - u'Cloud Container Engine - User Guide', - u'OpenTelekomCloud', 'manual'), -] +latex_documents = []