Skip to content

Commit

Permalink
Update Confpy for Docs (#364)
Browse files Browse the repository at this point in the history
Update Confpy for Docs

Reviewed-by: Tino Schr
  • Loading branch information
SebastianGode authored Nov 15, 2024
1 parent f49821f commit ffa3f6b
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 5 deletions.
6 changes: 6 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
otcdocstheme # Ansible-2.0
sphinx
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
setuptools
gitpython
Empty file added doc/source/_static/.placeholder
Empty file.
105 changes: 100 additions & 5 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
import sys
from git import Repo
from datetime import datetime

# -- Project information -----------------------------------------------------

project = 'Open Telekom Cloud Ansible Modules Documentation'
Expand All @@ -28,16 +33,14 @@
# ones.
extensions = [
'otcdocstheme',
'otc_sphinx_directives',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx_antsibull_ext'
]

antsibull_ext_color_scheme = 'default-autodark'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
Expand All @@ -46,11 +49,103 @@

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
otcdocs_auto_name = False
otcdocs_auto_version = False

otcdocs_repo_name = 'opentelekomcloud/ansible-collection-cloud'
# Those variables are required for edit/bug links

# Those variables are needed for indexing into OpenSearch
otcdocs_doc_environment = ''
otcdocs_doc_link = ''
otcdocs_doc_title = ''
otcdocs_doc_type = ''
otcdocs_service_category = ''
otcdocs_service_title = 'Ansible Collection opentelekomcloud.cloud'
otcdocs_service_type = ''
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.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('./'))

# -- General configuration ----------------------------------------------------
# https://docutils.sourceforge.io/docs/user/smartquotes.html - it does not
# what it is expected
smartquotes = False

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#
source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
language = 'en'

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
show_authors = False

# -- Options for HTML output --------------------------------------------------

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
html_theme = 'otcdocs'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
}

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".

html_title = "Open Telekom Cloud Ansible Modules Documentation"


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
templates_path = ['_templates']

# Do not include sources into the rendered results
html_copy_source = False

# -- Options for PDF output --------------------------------------------------
latex_documents = []

# Get the Git commit values for last updated timestamp on each page
repo = Repo(search_parent_directories=True)
commit = repo.head.commit
current_commit_hash = commit.hexsha
current_commit_time = commit.committed_datetime.strftime('%Y-%m-%d %H:%M')

latex_elements = {
'papersize': 'a4paper',
'pointsize': '12pt',
'figure_align': 'H',
'preamble': rf'''
\newcommand{{\githash}}{{{current_commit_hash}}}
\newcommand{{\gitcommittime}}{{{current_commit_time}}}
\newcommand{{\doctitle}}{{{otcdocs_doc_title}}}
\newcommand{{\servicetitle}}{{{otcdocs_service_title}}}
''',
'sphinxsetup': 'hmargin={15mm,15mm}, vmargin={20mm,30mm}, marginpar=10mm'
}

0 comments on commit ffa3f6b

Please sign in to comment.