Skip to content

Commit 9a3cf96

Browse files
authored
Merge pull request #468 from intelkevinputnam/docs-add-sphinx
Documentation: adds ability to build Read the Docs static site.
2 parents ff18b8a + a918b6c commit 9a3cf96

File tree

7 files changed

+161
-0
lines changed

7 files changed

+161
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ deployments/fpga_admissionwebhook/base/intel-fpga-webhook-certs-secret
2222
*.gbs.*
2323
*.aocx
2424
*.aocx.*
25+
26+
_build
27+
_work

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,28 @@ check-github-actions:
143143
(echo "Make sure all images are listed in .github/workflows/ci.yaml"; exit 1)
144144

145145
.PHONY: all format test lint build images $(cmds) $(images) lock-images vendor pre-pull set-version check-github-actions run-operator envtest deploy-operator undeploy-operator
146+
147+
SPHINXOPTS =
148+
SPHINXBUILD = sphinx-build
149+
SOURCEDIR = .
150+
BUILDDIR = _build
151+
152+
# Generate doc site under _build/html with Sphinx.
153+
vhtml: _work/venv/.stamp
154+
. _work/venv/bin/activate && \
155+
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
156+
cp docs/index.html $(BUILDDIR)/html/index.html
157+
158+
html:
159+
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
160+
cp docs/index.html $(BUILDDIR)/html/index.html
161+
162+
clean-html:
163+
rm -rf $(BUILDDIR)/html
164+
165+
# Set up a Python3 environment with the necessary tools for document creation.
166+
_work/venv/.stamp: docs/requirements.txt
167+
rm -rf ${@D}
168+
python3 -m venv ${@D}
169+
. ${@D}/bin/activate && pip install -r $<
170+
touch $@

conf.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
from docutils import nodes
17+
from os.path import isdir, isfile, join, basename, dirname
18+
from os import makedirs, getenv
19+
from shutil import copyfile
20+
from pygments.lexers.go import GoLexer
21+
from sphinx.highlighting import lexers
22+
23+
#############
24+
#
25+
# Add a special lexer to add a class to console lexer
26+
#
27+
#############
28+
29+
class goLangLexer (GoLexer):
30+
name = 'golang'
31+
32+
lexers['golang'] = goLangLexer(startinLine=True)
33+
34+
# -- Project information -----------------------------------------------------
35+
36+
project = 'Intel® Device Plugins for Kubernetes'
37+
copyright = '2020, various'
38+
author = 'various'
39+
40+
41+
##############################################################################
42+
#
43+
# This section determines the behavior of links to local items in .md files.
44+
#
45+
# if useGitHubURL == True:
46+
#
47+
# links to local files and directories will be turned into github URLs
48+
# using either the baseBranch defined here or using the commit SHA.
49+
#
50+
# if useGitHubURL == False:
51+
#
52+
# local files will be moved to the website directory structure when built
53+
# local directories will still be links to github URLs
54+
#
55+
# if built with GitHub workflows:
56+
#
57+
# the GitHub URLs will use the commit SHA (GITHUB_SHA environment variable
58+
# is defined by GitHub workflows) to link to the specific commit.
59+
#
60+
##############################################################################
61+
62+
baseBranch = "master"
63+
useGitHubURL = True
64+
commitSHA = getenv('GITHUB_SHA')
65+
githubBaseURL = "https://github.com/intel/intel-device-plugins-for-kubernetes/"
66+
githubFileURL = githubBaseURL + "blob/"
67+
githubDirURL = githubBaseURL + "tree/"
68+
if commitSHA:
69+
githubFileURL = githubFileURL + commitSHA + "/"
70+
githubDirURL = githubDirURL + commitSHA + "/"
71+
else:
72+
githubFileURL = githubFileURL + baseBranch + "/"
73+
githubDirURL = githubDirURL + baseBranch + "/"
74+
75+
# -- General configuration ---------------------------------------------------
76+
77+
# Add any Sphinx extension module names here, as strings. They can be
78+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
79+
# ones.
80+
extensions = ['recommonmark','sphinx_markdown_tables','sphinx_md']
81+
source_suffix = {'.rst': 'restructuredtext','.md': 'markdown'}
82+
83+
84+
# Add any paths that contain templates here, relative to this directory.
85+
templates_path = ['_templates']
86+
87+
# List of patterns, relative to source directory, that match files and
88+
# directories to ignore when looking for source files.
89+
# This pattern also affects html_static_path and html_extra_path.
90+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store','_work','cmd/fpga_plugin/pictures']
91+
92+
93+
# -- Options for HTML output -------------------------------------------------
94+
95+
# The theme to use for HTML and HTML Help pages. See the documentation for
96+
# a list of builtin themes.
97+
#
98+
html_theme = 'sphinx_rtd_theme'
99+
100+
# Add any paths that contain custom static files (such as style sheets) here,
101+
# relative to this directory. They are copied after the builtin static files,
102+
# so a file named "default.css" will overwrite the builtin "default.css".
103+
#html_static_path = ['_static']

docs/extensions.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Extensions
2+
##########
3+
4+
.. toctree::
5+
6+
../cmd/fpga_admissionwebhook/README.md
7+
../cmd/fpga_crihook/README.md
8+
../cmd/fpga_plugin/README.md
9+
../cmd/fpga_tool/README.md
10+
../cmd/gpu_plugin/README.md
11+
../cmd/operator/README.md
12+
../cmd/qat_plugin/README.md
13+
../cmd/sgx_plugin/README.md
14+
../cmd/vpu_plugin/README.md

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="refresh" content="0; URL='README.html'" />

docs/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sphinx
2+
sphinx_rtd_theme
3+
recommonmark
4+
sphinx-markdown-tables
5+
sphinx-md

index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Intel® Device Plugins for Kubernetes
2+
####################################
3+
4+
.. toctree::
5+
6+
README.md
7+
DEVEL.md
8+
docs/extensions.rst
9+
demo/readme.md
10+
Project GitHub repository <https://github.com/intel/intel-device-plugins-for-kubernetes>

0 commit comments

Comments
 (0)