Skip to content

Commit 81ac128

Browse files
Add Scylla Sphinx Theme 1.0 (#50)
* Upgrade Sphinx theme to version 1.x * Update docs/source/conf.py Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update .github/workflows/[email protected] Co-authored-by: David Garcia <[email protected]> * Update docs build scripts Co-authored-by: Laura Novich <[email protected]> Co-authored-by: Laura Novich <[email protected]>
1 parent 2c5bb1c commit 81ac128

File tree

5 files changed

+77
-120
lines changed

5 files changed

+77
-120
lines changed
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
name: "CI Docs"
1+
name: "Docs / Publish"
22

33
on:
44
push:
55
branches:
66
- master
77
paths:
8-
- 'docs/**'
9-
- 'topics/**'
8+
- "docs/**"
9+
- "topics/**"
10+
workflow_dispatch:
11+
1012
jobs:
1113
release:
12-
name: Build
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout
@@ -21,14 +22,11 @@ jobs:
2122
uses: actions/setup-python@v1
2223
with:
2324
python-version: 3.7
24-
- name: Set up Doxygen
25-
run: sudo apt-get install doxygen
25+
- name: Set up Doxygen
26+
run: sudo apt-get install doxygen
2627
- name: Build docs
27-
run: |
28-
export PATH=$PATH:~/.local/bin
29-
cd docs
30-
make multiversion
31-
- name: Deploy
32-
run : ./docs/_utils/deploy.sh
28+
run: make -C docs multiversion
29+
- name: Deploy docs to GitHub Pages
30+
run: ./docs/_utils/deploy.sh
3331
env:
3432
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Docs / Build PR"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- "docs/**"
9+
- "topics/**"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
with:
18+
persist-credentials: false
19+
fetch-depth: 0
20+
- name: Set up Python
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: 3.7
24+
- name: Set up Doxygen
25+
run: sudo apt-get install doxygen
26+
- name: Build docs
27+
run: make -C docs test

docs/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ DOXYGENDIR = ../doxygen
1111
PAPEROPT_a4 = -D latex_paper_size=a4
1212
PAPEROPT_letter = -D latex_paper_size=letter
1313
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
14+
TESTSPHINXOPTS = $(ALLSPHINXOPTS) -W --keep-going
15+
1416
# the i18n builder cannot share the environment and doctrees with the others
1517
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
1618

@@ -82,3 +84,9 @@ multiversion: setup
8284
.PHONY: multiversionpreview
8385
multiversionpreview: multiversion
8486
$(POETRY) run python3 -m http.server 5500 --directory $(BUILDDIR)/dirhtml
87+
88+
.PHONY: test
89+
test: setup
90+
$(SPHINXBUILD) -b dirhtml $(TESTSPHINXOPTS) $(BUILDDIR)/dirhtml
91+
@echo
92+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

docs/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ python = "^3.7"
99
pyyaml = "5.3"
1010
pygments = "2.2.0"
1111
recommonmark = "0.5.0"
12-
sphinx-scylladb-theme = "~0.1.11"
12+
sphinx-scylladb-theme = "~1.0.0"
1313
sphinx-sitemap = "2.1.0"
1414
sphinx-autobuild = "0.7.1"
1515
Sphinx = "2.4.4"

docs/source/conf.py

Lines changed: 31 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@
66
import subprocess
77
from datetime import date
88
from docutils import nodes
9-
from sphinx.util import logging
109
from recommonmark.transform import AutoStructify
1110
from recommonmark.parser import CommonMarkParser, splitext, urlparse
1211
from sphinx_scylladb_theme.utils import multiversion_regex_builder
1312

14-
logger = logging.getLogger(__name__)
15-
1613
# -- General configuration ------------------------------------------------
1714

18-
# If your documentation needs a minimal Sphinx version, state it here.
19-
#
20-
needs_sphinx = '1.8'
2115
sys.path.insert(0, os.path.abspath('../../'))
2216

2317
# Add any Sphinx extension module names here, as strings. They can be
@@ -86,15 +80,6 @@ def replace_relative_links(app, docname, source):
8680
copyright = str(date.today().year) + ', ScyllaDB. All rights reserved.'
8781
author = u'Scylla Project Contributors'
8882

89-
# The version info for the project you're documenting, acts as replacement for
90-
# |version| and |release|, also used in various other places throughout the
91-
# built documents.
92-
#
93-
# The short X.Y version.
94-
version = u'2.15'
95-
# The full version, including alpha/beta/rc tags.
96-
release = u'2.15.3'
97-
9883
# The language for content autogenerated by Sphinx. Refer to documentation
9984
# for a list of supported languages.
10085
#
@@ -113,15 +98,6 @@ def replace_relative_links(app, docname, source):
11398
# If true, `todo` and `todoList` produce output, else they produce nothing.
11499
todo_include_todos = True
115100

116-
# Custom lexer
117-
from pygments.lexers.shell import BashLexer
118-
from sphinx.highlighting import lexers
119-
sys.path.insert(0, os.path.abspath('../_utils'))
120-
from cql import CQLLexer
121-
122-
class DitaaLexer(BashLexer):
123-
pass
124-
125101
# Setup Sphinx
126102
def setup(app):
127103
app.add_source_parser(CustomCommonMarkParser)
@@ -141,56 +117,6 @@ def setup(app):
141117
app.connect('source-read', replace_relative_links)
142118
app.connect("builder-inited", generate_doxygen)
143119

144-
#Install custom lexers
145-
app.add_lexer("cql", CQLLexer())
146-
app.add_lexer("ditaa", DitaaLexer())
147-
148-
# Custom variables
149-
rst_prolog = """
150-
.. |mon_version| replace:: 3.1
151-
"""
152-
153-
# -- Options for HTML output ----------------------------------------------
154-
155-
# The theme to use for HTML and HTML Help pages. See the documentation for
156-
# a list of builtin themes.
157-
#
158-
html_theme = 'sphinx_scylladb_theme'
159-
html_style = ''
160-
161-
# Theme options are theme-specific and customize the look and feel of a theme
162-
# further. For a list of options available for each theme, see the
163-
# documentation.
164-
#
165-
html_theme_options = {
166-
'header_links': [
167-
('C/C++ Driver', 'https://cpp-driver.docs.scylladb.com/'),
168-
('Scylla Cloud', 'https://docs.scylladb.com/scylla-cloud/'),
169-
('Scylla University', 'https://university.scylladb.com/'),
170-
('ScyllaDB Home', 'https://www.scylladb.com/')],
171-
'github_issues_repository': 'scylladb/cpp-driver',
172-
}
173-
174-
extlinks = {}
175-
176-
# If not None, a 'Last updated on:' timestamp is inserted at every page
177-
# bottom, using the given strftime format.
178-
# The empty string is equivalent to '%b %d, %Y'.
179-
#
180-
html_last_updated_fmt = '%d %B %Y'
181-
182-
# Custom sidebar templates, maps document names to template names.
183-
#
184-
html_sidebars = {'**': ['side-nav.html']}
185-
186-
# Output file base name for HTML help builder.
187-
htmlhelp_basename = 'ScyllaDocumentationdoc'
188-
189-
# URL which points to the root of the HTML documentation.
190-
html_baseurl = 'https://cpp-driver.docs.scylladb.com'
191-
192-
# Dictionary of values to pass into the template engine’s context for all pages
193-
html_context = {'html_baseurl': html_baseurl}
194120

195121
# -- Options for not found extension -------------------------------------------
196122

@@ -255,43 +181,41 @@ def generate_doxygen(app):
255181
DOXYGEN_XML_DIR = breathe_projects[breathe_default_project]
256182
_generate_doxygen_rst(DOXYGEN_XML_DIR, app.builder.srcdir + '/api')
257183

258-
# -- Options for LaTeX page output ---------------------------------------
259-
260-
# Grouping the document tree into LaTeX files. List of tuples
261-
# (source start file, target name, title,
262-
# author, documentclass [howto, manual, or own class]).
263-
latex_documents = [
264-
(master_doc, 'ScyllaDocumentation.tex', u'Scylla Driver Documentation',
265-
u'Scylla Project Contributors', 'manual'),
266-
]
184+
# -- Options for HTML output ----------------------------------------------
267185

268-
# -- Options for manual page output ---------------------------------------
186+
# The theme to use for HTML and HTML Help pages. See the documentation for
187+
# a list of builtin themes.
188+
#
189+
html_theme = 'sphinx_scylladb_theme'
269190

270-
# One entry per manual page. List of tuples
271-
# (source start file, name, description, authors, manual section).
272-
man_pages = [
273-
(master_doc, 'scylladocumentation', u'Scylla Driver Documentation',
274-
[author], 1)
275-
]
191+
# Theme options are theme-specific and customize the look and feel of a theme
192+
# further. For a list of options available for each theme, see the
193+
# documentation.
194+
#
195+
html_theme_options = {
196+
'conf_py_path': 'docs/source/',
197+
'default_branch': 'master',
198+
'github_repository': 'scylladb/cpp-driver',
199+
'github_issues_repository': 'scylladb/cpp-driver',
200+
'hide_edit_this_page_button': 'false',
201+
'hide_sidebar_index': 'false'
202+
}
276203

277-
# -- Options for Texinfo output -------------------------------------------
204+
# If not None, a 'Last updated on:' timestamp is inserted at every page
205+
# bottom, using the given strftime format.
206+
# The empty string is equivalent to '%b %d, %Y'.
207+
#
208+
html_last_updated_fmt = '%d %B %Y'
278209

279-
# Grouping the document tree into Texinfo files. List of tuples
280-
# (source start file, target name, title, author,
281-
# dir menu entry, description, category)
282-
texinfo_documents = [
283-
(master_doc, 'ScyllaDocumentation', u'Scylla Driver Documentation',
284-
author, 'ScyllaDocumentation', 'One line description of project.',
285-
'Miscellaneous'),
286-
]
210+
# Custom sidebar templates, maps document names to template names.
211+
#
212+
html_sidebars = {'**': ['side-nav.html']}
287213

288-
# -- Options for Epub output ----------------------------------------------
214+
# Output file base name for HTML help builder.
215+
htmlhelp_basename = 'ScyllaDocumentationdoc'
289216

290-
# Bibliographic Dublin Core info.
291-
epub_title = project
292-
epub_author = author
293-
epub_publisher = author
294-
epub_copyright = copyright
217+
# URL which points to the root of the HTML documentation.
218+
html_baseurl = 'https://cpp-driver.docs.scylladb.com'
295219

296-
# A list of files that should not be packed into the epub file.
297-
epub_exclude_files = ['search.html']
220+
# Dictionary of values to pass into the template engine’s context for all pages
221+
html_context = {'html_baseurl': html_baseurl}

0 commit comments

Comments
 (0)