10
10
11
11
docs_path = Path (__file__ ).parent
12
12
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 ))
14
15
github_links_root_path = str (opendds_root_path )
15
16
16
17
from mpc_lexer import MpcLexer
@@ -35,6 +36,7 @@ def setup(app):
35
36
copyright = '2023, OpenDDS Foundation'
36
37
author = 'OpenDDS Foundation'
37
38
github_links_repo = 'OpenDDS/OpenDDS'
39
+ github_repo = 'https://github.com/' + github_links_repo
38
40
39
41
# Get Version Info
40
42
with (opendds_root_path / 'dds/Version.h' ).open () as f :
@@ -76,8 +78,14 @@ def get_version_prop(kind, macro):
76
78
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
77
79
# ones.
78
80
extensions = [
79
- 'sphinx.ext.ifconfig' ,
81
+ # Custom ones
80
82
'links' ,
83
+
84
+ # Official ones
85
+ 'sphinx.ext.ifconfig' ,
86
+
87
+ # Other ones
88
+ 'sphinx_copybutton' ,
81
89
]
82
90
83
91
# Add any paths that contain templates here, relative to this directory.
@@ -110,35 +118,53 @@ def get_version_prop(kind, macro):
110
118
r'^https?://github\.com/.*#.+$' ,
111
119
# Returns 403 for some reason
112
120
r'^https?://docs\.github\.com/.*$' ,
113
- # TODO: This needs to be fixed
114
- r'^http://download\.opendds\.org/modeling/eclipse_44/' ,
115
121
]
116
122
117
123
118
124
# -- Options for HTML output -------------------------------------------------
119
125
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".
130
126
html_static_path = ['.' ]
131
127
128
+ html_theme = 'furo'
129
+ # See documentation for the theme here:
130
+ # https://pradyunsg.me/furo/
131
+
132
+ html_title = project + ' ' + version
133
+
132
134
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
+ ]
142
168
}
143
169
144
170
html_favicon = 'logo_32_32.ico'
0 commit comments