From 4e1d566d42f51c90018ee5e4d659eeb3f83ba472 Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Fri, 10 Nov 2023 12:15:20 +0000 Subject: [PATCH] Update tox.ini && conf.py file Performed-by: gitea/infra/otc-metadata/tools/generate_doc_confpy.py --- api-ref/source/conf.py | 7 +--- doc/requirements.txt | 3 ++ doc/source/conf.py | 11 ++++++ tox.ini | 76 +++++++++++++++++++++++------------------- 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index a5297e9..3967284 100644 --- a/api-ref/source/conf.py +++ b/api-ref/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'Document Database Service - API Reference', - u'OpenTelekomCloud', 'manual'), -] +latex_documents = [] 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 42ea2dd..081ed8a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -31,6 +31,17 @@ otcdocs_repo_name = 'docs/document-database-service' 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 = 'database' +otcdocs_service_title = 'Document Database Service' +otcdocs_service_type = 'dds' +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 903b641..c11e394 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:api-ref]commands} + {[testenv:json-api-ref]commands} {[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} @@ -57,6 +58,35 @@ 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_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 + + + # HTML version [testenv:umn] deps = {[testenv:docs]deps} @@ -64,7 +94,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 @@ -109,7 +140,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] @@ -123,6 +157,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] @@ -143,34 +179,6 @@ commands = cp doc/best-practice/build/pdf/dds-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/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 - - - [doc8] ignore = D001