Skip to content

Commit 2f18b2c

Browse files
Merge pull request #4127 from iguessthislldo/igtd/dev-guidelines
Expand and Fix Dev Guidelines, Change Sphinx Theme
2 parents 92bded8 + 58d9d18 commit 2f18b2c

File tree

6 files changed

+179
-95
lines changed

6 files changed

+179
-95
lines changed

docs/conf.py

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
docs_path = Path(__file__).parent
1212
opendds_root_path = docs_path.parent
13-
sys.path.append(str((docs_path / 'sphinx_extensions').resolve()))
13+
ext = (docs_path / 'sphinx_extensions').resolve()
14+
sys.path.append(str(ext))
1415
github_links_root_path = str(opendds_root_path)
1516

1617
from mpc_lexer import MpcLexer
@@ -35,6 +36,7 @@ def setup(app):
3536
copyright = '2023, OpenDDS Foundation'
3637
author = 'OpenDDS Foundation'
3738
github_links_repo = 'OpenDDS/OpenDDS'
39+
github_repo = 'https://github.com/' + github_links_repo
3840

3941
# Get Version Info
4042
with (opendds_root_path / 'dds/Version.h').open() as f:
@@ -76,8 +78,14 @@ def get_version_prop(kind, macro):
7678
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
7779
# ones.
7880
extensions = [
79-
'sphinx.ext.ifconfig',
81+
# Custom ones
8082
'links',
83+
84+
# Official ones
85+
'sphinx.ext.ifconfig',
86+
87+
# Other ones
88+
'sphinx_copybutton',
8189
]
8290

8391
# Add any paths that contain templates here, relative to this directory.
@@ -110,35 +118,53 @@ def get_version_prop(kind, macro):
110118
r'^https?://github\.com/.*#.+$',
111119
# Returns 403 for some reason
112120
r'^https?://docs\.github\.com/.*$',
113-
# TODO: This needs to be fixed
114-
r'^http://download\.opendds\.org/modeling/eclipse_44/',
115121
]
116122

117123

118124
# -- Options for HTML output -------------------------------------------------
119125

120-
# The theme to use for HTML and HTML Help pages. See the documentation for
121-
# a list of builtin themes.
122-
#
123-
html_theme = 'alabaster'
124-
# See documentation for alabaster here:
125-
# https://alabaster.readthedocs.io/en/latest/customization.html
126-
127-
# Add any paths that contain custom static files (such as style sheets) here,
128-
# relative to this directory. They are copied after the builtin static files,
129-
# so a file named "default.css" will overwrite the builtin "default.css".
130126
html_static_path = ['.']
131127

128+
html_theme = 'furo'
129+
# See documentation for the theme here:
130+
# https://pradyunsg.me/furo/
131+
132+
html_title = project + ' ' + version
133+
132134
html_theme_options = {
133-
'logo': 'logo_with_name.svg',
134-
'logo_name': False,
135-
'extra_nav_links': {
136-
'Main Website': 'https://opendds.org',
137-
'GitHub Repo': 'https://github.com/' + github_links_repo,
138-
},
139-
'fixed_sidebar': False,
140-
'page_width': '1100px',
141-
'body_max_width': '1100px',
135+
'light_logo': 'logo_with_name.svg',
136+
'dark_logo': 'logo_with_name.svg',
137+
'sidebar_hide_name': True, # Logo has the name in it
138+
# furo doesn't support a veiw source link for some reason, force edit
139+
# button to do that.
140+
'source_edit_link': github_repo + '/blob/master/docs/{filename}?plain=1',
141+
}
142+
143+
# Change the sidebar to include fixed links
144+
# https://pradyunsg.me/furo/customisation/sidebar/#making-changes
145+
sidebar_links = {
146+
'Main Website': 'https://opendds.org',
147+
'GitHub Repo': github_repo,
148+
}
149+
our_template_path = ext / 'templates'
150+
sidebar_links_template_name = 'sidebar-links.html'
151+
with (our_template_path / sidebar_links_template_name).open('w') as f:
152+
print('<div class="sidebar-tree" style="margin-top: 0px;"><ul>', file=f)
153+
for name, url in sidebar_links.items():
154+
print(' <li><a class="reference" href="{}">{}</a></li>'.format(url, name), file=f)
155+
print('</ul></div>', file=f)
156+
templates_path = [str(our_template_path)]
157+
html_sidebars = {
158+
'**': [
159+
'sidebar/brand.html',
160+
sidebar_links_template_name,
161+
'sidebar/search.html',
162+
'sidebar/scroll-start.html',
163+
'sidebar/navigation.html',
164+
'sidebar/ethical-ads.html',
165+
'sidebar/scroll-end.html',
166+
'sidebar/variant-selector.html',
167+
]
142168
}
143169

144170
html_favicon = 'logo_32_32.ico'

docs/custom.css

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)