Skip to content

Commit fd28e40

Browse files
Jonas Berghefloryd
Jonas Berg
authored andcommittedApr 20, 2023
Update HTML theme
1 parent b20546d commit fd28e40

10 files changed

+74
-56
lines changed
 

‎.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: sudo apt-get install doxygen libsnmp-dev python3-pip texlive-latex-recommended texlive-fonts-recommended tex-gyre texlive-latex-extra latexmk
1818

1919
- name: Install Python dependencies
20-
run: pip3 install -r ${{github.workspace}}/doc/doc_requirements.txt
20+
run: pip3 install -r ${{github.workspace}}/doc/requirements.txt
2121

2222
- name: Show Python dependencies
2323
run: pip3 freeze

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ doc/_copied
1010
.cproject
1111
.project
1212

13+
14+
# Python files
15+
*env*
16+
1317
# Object files
1418
*.o
1519
*.ko

‎doc/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ if (SPHINX_FOUND AND DOXYGEN_FOUND)
8787
add_sphinx_builder(sphinx-spelling spelling)
8888
add_sphinx_builder(sphinx-linkcheck linkcheck)
8989
add_sphinx_builder(sphinx-pdf latexpdf)
90+
add_dependencies(sphinx-html remove_badge_svg_images)
9091
add_dependencies(sphinx-pdf remove_badge_svg_images)
9192

93+
# Zip the documentation
94+
message("p-net revision: ${PROFINET_GIT_REVISION}")
95+
add_custom_command(
96+
TARGET sphinx-html POST_BUILD
97+
COMMAND zip -FS -r pnet_docs_${PROFINET_GIT_REVISION}.zip sphinx/html/ > /dev/null
98+
COMMAND echo "The Sphinx HTML and ZIP files are located in ${CMAKE_CURRENT_BINARY_DIR}"
99+
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/pnet_docs_${PROFINET_GIT_REVISION}.zip
100+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
101+
COMMENT "Zipping HTML documentation")
102+
92103
endif()

‎doc/README.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
To build the documentation, it is important to use the sphinx-build script
2+
installed in your virtual environment.
3+
Use CMAKE_IGNORE_PATH to prevent cmake from using a script installed elsewhere
4+
5+
Run these commands (adapt to your needs):
6+
7+
python3 -m venv myvenv
8+
source myvenv/bin/activate
9+
pip3 install -r doc/requirements.txt
10+
11+
cmake -B build -DCMAKE_IGNORE_PATH:PATH=$HOME/.local/bin
12+
cmake --build build/ --target sphinx-html

‎doc/conf.py

+26-25
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7+
8+
import os
79
import pathlib
810
import re
911
import sys
@@ -14,10 +16,6 @@
1416
# If extensions (or modules to document with autodoc) are in another directory,
1517
# add these directories to sys.path here. If the directory is relative to the
1618
# documentation root, use os.path.abspath to make it absolute, like shown here.
17-
#
18-
# import os
19-
# import sys
20-
# sys.path.insert(0, os.path.abspath('.'))
2119

2220
pathobj_docs_dir = pathlib.Path(__file__).parent.absolute()
2321
pathobj_rootdir = pathobj_docs_dir.parent.absolute()
@@ -42,16 +40,20 @@
4240
# ones.
4341
extensions = [
4442
"breathe",
45-
"myst_parser",
46-
"rst2pdf.pdfbuilder",
47-
"sphinx_rtd_theme",
43+
"recommonmark",
44+
"sphinx_copybutton",
45+
"sphinx_jinja",
46+
"sphinx.ext.autosectionlabel",
47+
"sphinx.ext.graphviz",
48+
"sphinxcontrib.kroki",
49+
"sphinxcontrib.programoutput",
4850
"sphinxcontrib.spelling",
4951
]
5052

5153
needs_sphinx = "1.8"
5254

5355
# Add any paths that contain templates here, relative to this directory.
54-
templates_path = ["_templates"]
56+
templates_path = ["../../_templates"]
5557

5658
# List of patterns, relative to source directory, that match files and
5759
# directories to ignore when looking for source files.
@@ -65,19 +67,17 @@
6567
'.md': 'markdown',
6668
}
6769

70+
breathe_projects = {project: "../build/doc/xml/"}
71+
breathe_default_project = project
6872

69-
# -- Options for HTML output -------------------------------------------------
7073

71-
# The theme to use for HTML and HTML Help pages. See the documentation for
72-
# a list of builtin themes.
73-
#
74-
html_theme = "sphinx_rtd_theme"
74+
# -- Options for HTML output -------------------------------------------------
7575

76-
# Add any paths that contain custom static files (such as style sheets) here,
77-
# relative to this directory. They are copied after the builtin static files,
78-
# so a file named "default.css" will overwrite the builtin "default.css".
79-
html_static_path = ["static"]
76+
html_context = {
77+
"default_mode": "light"
78+
}
8079

80+
html_theme = "sphinx_book_theme"
8181
html_theme_options = {
8282
"show_nav_level": 3,
8383
"home_page_in_toc": True,
@@ -89,14 +89,15 @@
8989
}
9090

9191
html_last_updated_fmt = "%Y-%m-%d %H:%M"
92-
breathe_projects = {project: "../build/doc/xml/"}
93-
breathe_default_project = project
94-
95-
html_css_files = [
96-
"../../css/custom_rtd.css", # Requested by web developer
97-
"css/fix_table_width.css",
98-
"css/change_header_size.css",
99-
]
92+
html_static_path = ["static"]
93+
html_logo = "static/i/p-net.svg"
94+
html_show_sourcelink = False
95+
96+
if os.getenv("USE_EXTERNAL_CSS") is not None:
97+
html_css_files = [
98+
"https://rt-labs.com/content/themes/rtlabs2020/assets/css/style.css",
99+
"https://rt-labs.com/content/themes/rtlabs2020/assets/css/rt_custom_sphinx.css",
100+
]
100101

101102

102103
# -- Options for PDF output -------------------------------------------------

‎doc/doc_requirements.txt

-12
This file was deleted.

‎doc/requirements.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Solve issue with missing bullet points
2+
# See https://stackoverflow.com/questions/67542699/readthedocs-sphinx-not-rendering-bullet-list-from-rst-file
3+
docutils==0.17.1
4+
5+
# Use versions that fit the docutils version
6+
breathe==4.34.0
7+
codespell==2.2.2
8+
graphviz==0.20.1
9+
myst-parser==0.18.1
10+
recommonmark==0.7.1
11+
rst2pdf==0.99
12+
rstcloth==0.5.3
13+
sphinx_book_theme==1.0.1
14+
sphinx-copybutton==0.5.1
15+
sphinx-jinja==2.0.2
16+
Sphinx==5.3.0
17+
sphinxcontrib-kroki==1.3.0
18+
sphinxcontrib-programoutput==0.17
19+
sphinxcontrib-spelling==8.0.0

‎doc/static/css/change_header_size.css

-3
This file was deleted.

‎doc/static/css/fix_table_width.css

-15
This file was deleted.

‎doc/static/i/p-net.svg

+1
Loading

0 commit comments

Comments
 (0)