forked from ros2/ros2_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
493 lines (431 loc) · 31.2 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# -*- coding: utf-8 -*-
#
# rosindex documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 2 16:34:57 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import itertools
import json
from pathlib import Path
import shutil
from docutils.parsers.rst import Directive
from fnmatch import fnmatch
from string import Template
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# The master toctree document.
master_doc = 'index'
# The default role
default_role = 'any'
# The set of warnings to suppress.
suppress_warnings = ['image.nonlocal_uri']
# General information about the project.
project = u'ros2 documentation'
copyright = u'2018, Open Robotics'
author = u'Open Robotics'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u''
# The full version, including alpha/beta/rc tags.
release = u''
# Define the default role to use for links
default_role = 'any'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['**/_*.rst']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
extensions = ['sphinx.ext.intersphinx']
# Intersphinx mapping
intersphinx_mapping = {
'catkin_pkg': ('http://docs.ros.org/en/independent/api/catkin_pkg/html', None),
'jenkins_tools': ('http://docs.ros.org/en/independent/api/jenkins_tools/html', None),
'rosdep': ('http://docs.ros.org/en/independent/api/rosdep/html', None),
'rosdistro': ('http://docs.ros.org/en/independent/api/rosdistro/html', None),
'rosinstall': ('http://docs.ros.org/en/independent/api/rosinstall/html', None),
'rospkg': ('http://docs.ros.org/en/independent/api/rospkg/html', None),
'vcstools': ('http://docs.ros.org/en/independent/api/vcstools/html', None)
}
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_favicon = 'favicon.ico'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# Drop any source link suffix
html_sourcelink_suffix = ''
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'ros2_docsdoc'
# Ideally we would be able to do redirects of all kinds from https://index.ros.org to https://docs.ros.org .
# Unfortunately, since index.ros.org is served from GitHub pages, we can only do http-equiv redirects,
# and those redirects only work for HTML files. For the non-HTML files (of which there are only a handful),
# we copy them into place on index.ros.org and continue to serve them there (as well as from
# docs.ros.org). We'll eventually remove them.
custom_copy_files = {
'Marketing/ros2-brochure-a4-print.pdf': '_downloads/e3c5f4c252ce7cba47b7a190741fded0/ros2-brochure-a4-print.pdf',
'Marketing/ros2-brochure-a4-web.pdf': '_downloads/ca487a5e252ef6910bcb40402640bde6/ros2-brochure-a4-web.pdf',
'Marketing/ros2-brochure-ltr-print.pdf': '_downloads/b837b51f4eec5fd5da351747777193fa/ros2-brochure-ltr-print.pdf',
'Marketing/ros2-brochure-ltr-web.pdf': '_downloads/8e25980591e39eda300136ddebc9e97b/ros2-brochure-ltr-web.pdf',
}
redirects = {
# top-level
'index': 'https://docs.ros.org/en/rolling/index.html',
'Concepts': 'https://docs.ros.org/en/rolling/Concepts.html',
'Contact': 'https://docs.ros.org/en/rolling/Contact.html',
'Contributing': 'https://docs.ros.org/en/rolling/Contributing.html',
'Feature-Ideas': 'https://docs.ros.org/en/rolling/Feature-Ideas.html',
'Features': 'https://docs.ros.org/en/rolling/Features.html',
'Glossary': 'https://docs.ros.org/en/rolling/Glossary.html',
'Governance': 'https://docs.ros.org/en/rolling/Governance.html',
'Installation': 'https://docs.ros.org/en/rolling/Installation.html',
'Marketing': 'https://docs.ros.org/en/rolling/Marketing.html',
'Related-Projects': 'https://docs.ros.org/en/rolling/Related-Projects.html',
'Releases': 'https://docs.ros.org/en/rolling/Releases.html',
'Roadmap': 'https://docs.ros.org/en/rolling/Roadmap.html',
'ROSCon-Content': 'https://docs.ros.org/en/rolling/ROSCon-Content.html',
'Troubleshooting': 'https://docs.ros.org/en/rolling/Guides/Installation-Troubleshooting.html',
'Tutorials': 'https://docs.ros.org/en/rolling/Tutorials.html',
# Concepts
'Concepts/About-Build-System': 'https://docs.ros.org/en/rolling/Concepts/About-Build-System.html',
'Concepts/About-Client-Interfaces': 'https://docs.ros.org/en/rolling/Concepts/About-Client-Interfaces.html',
'Concepts/About-Different-Middleware-Vendors': 'https://docs.ros.org/en/rolling/Concepts/About-Different-Middleware-Vendors.html',
'Concepts/About-Internal-Interfaces': 'https://docs.ros.org/en/rolling/Concepts/About-Internal-Interfaces.html',
'Concepts/About-Logging': 'https://docs.ros.org/en/rolling/Concepts/About-Logging.html',
'Concepts/About-Middleware-Implementations': 'https://docs.ros.org/en/rolling/Concepts/About-Middleware-Implementations.html',
'Concepts/About-Quality-of-Service-Settings': 'https://docs.ros.org/en/rolling/Concepts/About-Quality-of-Service-Settings.html',
'Concepts/About-ROS-2-Client-Libraries': 'https://docs.ros.org/en/rolling/Concepts/About-ROS-2-Client-Libraries.html',
'Concepts/About-ROS-2-Parameters': 'https://docs.ros.org/en/rolling/Concepts/About-ROS-2-Parameters.html',
'Concepts/About-ROS-Interfaces': 'https://docs.ros.org/en/rolling/Concepts/About-ROS-Interfaces.html',
'Concepts/About-Topic-Statistics': 'https://docs.ros.org/en/rolling/Concepts/About-Topic-Statistics.html',
# Contributing
'Contributing/Build-Cop-and-Build-Farmer-Guide': 'https://docs.ros.org/en/eloquent/Contributing/Build-Cop-and-Build-Farmer-Guide.html',
'Contributing/CI-Server-Setup': 'https://docs.ros.org/en/eloquent/Contributing/CI-Server-Setup.html',
'Contributing/Code-Style-Language-Versions': 'https://docs.ros.org/en/rolling/Contributing/Code-Style-Language-Versions.html',
'Contributing/Design-Guide': 'https://docs.ros.org/en/eloquent/Contributing/Design-Guide.html',
'Contributing/Developer-Guide': 'https://docs.ros.org/en/rolling/Contributing/Developer-Guide.html',
'Contributing/Examples-and-Tools-for-ROS1----ROS2-Migrations': 'https://docs.ros.org/en/rolling/Contributing/Migration-Guide.html#more-examples-and-tools',
'Contributing/Inter-Sphinx-Support': 'https://docs.ros.org/en/eloquent/Contributing/Inter-Sphinx-Support.html',
'Contributing/Migration-Guide-Python': 'https://docs.ros.org/en/rolling/Contributing/Migration-Guide-Python.html',
'Contributing/Migration-Guide': 'https://docs.ros.org/en/rolling/Contributing/Migration-Guide.html',
'Contributing/Quality-Guide': 'https://docs.ros.org/en/rolling/Contributing/Quality-Guide.html',
'Contributing/ROS-2-On-boarding-Guide': 'https://docs.ros.org/en/eloquent/Contributing/ROS-2-On-boarding-Guide.html',
'Contributing/Set-up-a-new-Linux-CI-node': 'https://docs.ros.org/en/eloquent/Contributing/Set-up-a-new-Linux-CI-node.html',
'Contributing/Set-up-a-new-macOS-CI-node': 'https://docs.ros.org/en/eloquent/Contributing/Set-up-a-new-macOS-CI-node.html',
'Contributing/Set-up-a-new-Windows-CI-node': 'https://docs.ros.org/en/eloquent/Contributing/Set-up-a-new-Windows-CI-node.html',
# Governance
'Governance/ROS2-TSC-Charter': 'https://docs.ros.org/en/rolling/Governance/ROS2-TSC-Charter.html',
# Installation
'Installation/DDS-Implementations': 'https://docs.ros.org/en/foxy/Installation/DDS-Implementations.html',
'Installation/Latest-Development-Setup': 'https://docs.ros.org/en/rolling/Installation/Latest-Development-Setup.html',
'Installation/Maintaining-a-Source-Checkout': 'https://docs.ros.org/en/rolling/Installation/Maintaining-a-Source-Checkout.html',
'Installation/Prerelease-Testing': 'https://docs.ros.org/en/rolling/Installation/Prerelease-Testing.html',
'Installation/Crystal': 'https://docs.ros.org/en/crystal/Installation.html',
'Installation/Crystal/Fedora-Development-Setup': 'https://docs.ros.org/en/crystal/Installation/Fedora-Development-Setup.html',
'Installation/Crystal/Linux-Development-Setup': 'https://docs.ros.org/en/crystal/Installation/Linux-Development-Setup.html',
'Installation/Crystal/Linux-Install-Binary': 'https://docs.ros.org/en/crystal/Installation/Linux-Install-Binary.html',
'Installation/Crystal/Linux-Install-Debians': 'https://docs.ros.org/en/crystal/Installation/Linux-Install-Debians.html',
'Installation/Crystal/macOS-Development-Setup': 'https://docs.ros.org/en/crystal/Installation/macOS-Development-Setup.html',
'Installation/Crystal/macOS-Install-Binary': 'https://docs.ros.org/en/crystal/Installation/macOS-Install-Binary.html',
'Installation/Crystal/Windows-Development-Setup': 'https://docs.ros.org/en/crystal/Installation/Windows-Development-Setup.html',
'Installation/Crystal/Windows-Install-Binary': 'https://docs.ros.org/en/crystal/Installation/Windows-Install-Binary.html',
'Installation/Dashing': 'https://docs.ros.org/en/dashing/Installation.html',
'Installation/Dashing/Fedora-Development-Setup': 'https://docs.ros.org/en/dashing/Installation/Fedora-Development-Setup.html',
'Installation/Dashing/Linux-Development-Setup': 'https://docs.ros.org/en/dashing/Installation/Linux-Development-Setup.html',
'Installation/Dashing/Linux-Install-Binary': 'https://docs.ros.org/en/dashing/Installation/Linux-Install-Binary.html',
'Installation/Dashing/Linux-Install-Debians': 'https://docs.ros.org/en/dashing/Installation/Linux-Install-Debians.html',
'Installation/Dashing/macOS-Development-Setup': 'https://docs.ros.org/en/dashing/Installation/macOS-Development-Setup.html',
'Installation/Dashing/macOS-Install-Binary': 'https://docs.ros.org/en/dashing/Installation/macOS-Install-Binary.html',
'Installation/Dashing/Windows-Development-Setup': 'https://docs.ros.org/en/dashing/Installation/Windows-Development-Setup.html',
'Installation/Dashing/Windows-Install-Binary': 'https://docs.ros.org/en/dashing/Installation/Windows-Install-Binary.html',
'Installation/DDS-Implementations/Install-Connext-Security-Plugins': 'https://docs.ros.org/en/foxy/Installation/DDS-Implementations/Install-Connext-Security-Plugins.html',
'Installation/DDS-Implementations/Install-Connext-University-Eval': 'https://docs.ros.org/en/foxy/Installation/DDS-Implementations/Install-Connext-University-Eval.html',
'Installation/DDS-Implementations/Working-with-Eclipse-CycloneDDS': 'https://docs.ros.org/en/foxy/Installation/DDS-Implementations/Working-with-Eclipse-CycloneDDS.html',
'Installation/Eloquent': 'https://docs.ros.org/en/eloquent/Installation.html',
'Installation/Eloquent/Fedora-Development-Setup': 'https://docs.ros.org/en/eloquent/Installation/Fedora-Development-Setup.html',
'Installation/Eloquent/Linux-Development-Setup': 'https://docs.ros.org/en/eloquent/Installation/Linux-Development-Setup.html',
'Installation/Eloquent/Linux-Install-Binary': 'https://docs.ros.org/en/eloquent/Installation/Linux-Install-Binary.html',
'Installation/Eloquent/Linux-Install-Debians': 'https://docs.ros.org/en/eloquent/Installation/Linux-Install-Debians.html',
'Installation/Eloquent/macOS-Development-Setup': 'https://docs.ros.org/en/eloquent/Installation/macOS-Development-Setup.html',
'Installation/Eloquent/macOS-Install-Binary': 'https://docs.ros.org/en/eloquent/Installation/macOS-Install-Binary.html',
'Installation/Eloquent/Windows-Development-Setup': 'https://docs.ros.org/en/eloquent/Installation/Windows-Development-Setup.html',
'Installation/Eloquent/Windows-Install-Binary': 'https://docs.ros.org/en/eloquent/Installation/Windows-Install-Binary.html',
'Installation/Foxy': 'https://docs.ros.org/en/foxy/Installation.html',
'Installation/Foxy/Fedora-Development-Setup': 'https://docs.ros.org/en/foxy/Installation/Fedora-Development-Setup.html',
'Installation/Foxy/Linux-Development-Setup': 'https://docs.ros.org/en/foxy/Installation/Linux-Development-Setup.html',
'Installation/Foxy/Linux-Install-Binary': 'https://docs.ros.org/en/foxy/Installation/Linux-Install-Binary.html',
'Installation/Foxy/Linux-Install-Debians': 'https://docs.ros.org/en/foxy/Installation/Linux-Install-Debians.html',
'Installation/Foxy/macOS-Development-Setup': 'https://docs.ros.org/en/foxy/Installation/macOS-Development-Setup.html',
'Installation/Foxy/macOS-Install-Binary': 'https://docs.ros.org/en/foxy/Installation/macOS-Install-Binary.html',
'Installation/Foxy/Windows-Development-Setup': 'https://docs.ros.org/en/foxy/Installation/Windows-Development-Setup.html',
'Installation/Foxy/Windows-Install-Binary': 'https://docs.ros.org/en/foxy/Installation/Windows-Install-Binary.html',
'Installation/Rolling': 'https://docs.ros.org/en/rolling/Installation.html',
'Installation/Rolling/Fedora-Development-Setup': 'https://docs.ros.org/en/rolling/Installation/Fedora-Development-Setup.html',
'Installation/Rolling/Linux-Development-Setup': 'https://docs.ros.org/en/rolling/Installation/Linux-Development-Setup.html',
'Installation/Rolling/Linux-Install-Binary': 'https://docs.ros.org/en/rolling/Installation/Linux-Install-Binary.html',
'Installation/Rolling/Linux-Install-Debians': 'https://docs.ros.org/en/rolling/Installation/Linux-Install-Debians.html',
'Installation/Rolling/macOS-Development-Setup': 'https://docs.ros.org/en/rolling/Installation/macOS-Development-Setup.html',
'Installation/Rolling/macOS-Install-Binary': 'https://docs.ros.org/en/rolling/Installation/macOS-Install-Binary.html',
'Installation/Rolling/Windows-Development-Setup': 'https://docs.ros.org/en/rolling/Installation/Windows-Development-Setup.html',
'Installation/Rolling/Windows-Install-Binary': 'https://docs.ros.org/en/rolling/Installation/Windows-Install-Binary.html',
# Marketing - no html files
# Related-Projects
'Related-Projects/Intel-ROS2-Projects': 'https://docs.ros.org/en/rolling/Related-Projects/Intel-ROS2-Projects.html',
# Releases
'Releases/Alpha-Overview': 'https://docs.ros.org/en/foxy/Releases/Alpha-Overview.html',
'Releases/Beta1-Overview': 'https://docs.ros.org/en/foxy/Releases/Beta1-Overview.html',
'Releases/Beta2-Overview': 'https://docs.ros.org/en/foxy/Releases/Beta2-Overview.html',
'Releases/Beta3-Overview': 'https://docs.ros.org/en/foxy/Releases/Beta3-Overview.html',
'Releases/Release-Ardent-Apalone': 'https://docs.ros.org/en/foxy/Releases/Release-Ardent-Apalone.html',
'Releases/Release-Bouncy-Bolson': 'https://docs.ros.org/en/foxy/Releases/Release-Bouncy-Bolson.html',
'Releases/Release-Crystal-Clemmys': 'https://docs.ros.org/en/foxy/Releases/Release-Crystal-Clemmys.html',
'Releases/Release-Dashing-Diademata': 'https://docs.ros.org/en/foxy/Releases/Release-Dashing-Diademata.html',
'Releases/Release-Eloquent-Elusor': 'https://docs.ros.org/en/foxy/Releases/Release-Eloquent-Elusor.html',
'Releases/Release-Foxy-Fitzroy': 'https://docs.ros.org/en/foxy/Releases/Release-Foxy-Fitzroy.html',
'Releases/Release-Galactic-Geochelone': 'https://docs.ros.org/en/foxy/Releases/Release-Galactic-Geochelone.html',
'Releases/Release-Howto': 'https://docs.ros.org/en/foxy/Releases/Release-Howto.html',
'Releases/Release-Rolling-Ridley': 'https://docs.ros.org/en/foxy/Releases/Release-Rolling-Ridley.html',
# Troubleshooting
'Troubleshooting/DDS-tuning': 'https://docs.ros.org/en/rolling/Troubleshooting/DDS-tuning.html',
'Troubleshooting/Installation-Troubleshooting': 'https://docs.ros.org/en/rolling/Troubleshooting/Installation-Troubleshooting.html',
# Tutorials
'Tutorials/Actions/Creating-an-Action': 'https://docs.ros.org/en/foxy/Tutorials/Actions/Creating-an-Action.html',
'Tutorials/Actions/Writing-a-Cpp-Action-Server-Client': 'https://docs.ros.org/en/foxy/Tutorials/Actions/Writing-a-Cpp-Action-Server-Client.html',
'Tutorials/Actions/Writing-a-Py-Action-Server-Client': 'https://docs.ros.org/en/foxy/Tutorials/Actions/Writing-a-Py-Action-Server-Client.html',
'Tutorials/Allocator-Template-Tutorial': 'https://docs.ros.org/en/foxy/Tutorials/Allocator-Template-Tutorial.html',
'Tutorials/Ament-CMake-Documentation': 'https://docs.ros.org/en/foxy/Tutorials/Ament-CMake-Documentation.html',
'Tutorials/Building-Realtime-rt_preempt-kernel-for-ROS-2': 'https://docs.ros.org/en/foxy/Tutorials/Building-Realtime-rt_preempt-kernel-for-ROS-2.html',
'Tutorials/Building-ROS-2-on-Linux-with-Eclipse-Oxygen': 'https://docs.ros.org/en/foxy/Tutorials/Building-ROS2-Package-with-eclipse-2021-06.html',
'Tutorials/catment': 'https://docs.ros.org/en/foxy/Concepts/About-Catment.html',
'Tutorials/Colcon-Tutorial': 'https://docs.ros.org/en/foxy/Tutorials/Colcon-Tutorial.html',
'Tutorials/Composition': 'https://docs.ros.org/en/foxy/Tutorials/Composition.html',
'Tutorials/Configuring-ROS2-Environment': 'https://docs.ros.org/en/foxy/Tutorials/Configuring-ROS2-Environment.html',
'Tutorials/Creating-Your-First-ROS2-Package': 'https://docs.ros.org/en/foxy/Tutorials/Creating-Your-First-ROS2-Package.html',
'Tutorials/Cross-compilation': 'https://docs.ros.org/en/foxy/Tutorials/Cross-compilation.html',
'Tutorials/Custom-ROS2-Interfaces': 'https://docs.ros.org/en/foxy/Tutorials/Custom-ROS2-Interfaces.html',
'Tutorials/Deploying-ROS-2-on-IBM-Cloud': 'https://docs.ros.org/en/foxy/Tutorials/Deploying-ROS-2-on-IBM-Cloud.html',
'Tutorials/Developing-a-ROS-2-Package': 'https://docs.ros.org/en/foxy/Tutorials/Developing-a-ROS-2-Package.html',
'Tutorials/dummy-robot-demo': 'https://docs.ros.org/en/foxy/Tutorials/dummy-robot-demo.html',
'Tutorials/Discovery-Server/Discovery-Server': 'https://docs.ros.org/en/foxy/Tutorials/Discovery-Server/Discovery-Server.html',
'Tutorials/Eclipse-Oxygen-with-ROS-2-and-rviz2': 'https://docs.ros.org/en/foxy/Tutorials/Eclipse-Oxygen-with-ROS-2-and-rviz2.html',
'Tutorials/Getting-Started-With-Ros2doctor': 'https://docs.ros.org/en/foxy/Tutorials/Getting-Started-With-Ros2doctor.html',
'Tutorials/Intra-Process-Communication': 'https://docs.ros.org/en/foxy/Tutorials/Intra-Process-Communication.html',
'Tutorials/Introspection-with-command-line-tools': 'https://docs.ros.org/en/foxy/Tutorials/Introspection-with-command-line-tools.html',
'Tutorials/Launch-Files/Creating-Launch-Files': 'https://docs.ros.org/en/foxy/Tutorials/Launch-Files/Creating-Launch-Files.html',
'Tutorials/Launch-files-migration-guide': 'https://docs.ros.org/en/foxy/Tutorials/Launch-files-migration-guide.html',
'Tutorials/Launch-system': 'https://docs.ros.org/en/foxy/Tutorials/Launch-system.html',
'Tutorials/Logging-and-logger-configuration': 'https://docs.ros.org/en/foxy/Tutorials/Logging-and-logger-configuration.html',
'Tutorials/Managed-Nodes': 'https://docs.ros.org/en/foxy/Tutorials/Managed-Nodes.html',
'Tutorials/Node-arguments': 'https://docs.ros.org/en/foxy/Tutorials/Node-arguments.html',
'Tutorials/Parameters/Understanding-ROS2-Parameters': 'https://docs.ros.org/en/foxy/Tutorials/Parameters/Understanding-ROS2-Parameters.html',
'Tutorials/Parameters-YAML-files-migration-guide': 'https://docs.ros.org/en/foxy/Tutorials/Parameters-YAML-files-migration-guide.html',
'Tutorials/Quality-of-Service': 'https://docs.ros.org/en/foxy/Tutorials/Quality-of-Service.html',
'Tutorials/Real-Time-Programming': 'https://docs.ros.org/en/foxy/Tutorials/Real-Time-Programming.html',
'Tutorials/Releasing-a-ROS-2-package-with-bloom': 'https://docs.ros.org/en/foxy/Tutorials/Releasing-a-ROS-2-package-with-bloom.html',
'Tutorials/Ros2bag/Overriding-QoS-Policies-For-Recording-And-Playback': 'https://docs.ros.org/en/foxy/Tutorials/Ros2bag/Overriding-QoS-Policies-For-Recording-And-Playback.html',
'Tutorials/Ros2bag/Recording-And-Playing-Back-Data': 'https://docs.ros.org/en/foxy/Tutorials/Ros2bag/Recording-And-Playing-Back-Data.html',
'Tutorials/Rosbag-with-ROS1-Bridge': 'https://docs.ros.org/en/foxy/Tutorials/Rosbag-with-ROS1-Bridge.html',
'Tutorials/Rqt-Console/Using-Rqt-Console': 'https://docs.ros.org/en/foxy/Tutorials/Rqt-Console/Using-Rqt-Console.html',
'Tutorials/RQt-Overview-Usage': 'https://docs.ros.org/en/foxy/Tutorials/RQt-Overview-Usage.html',
'Tutorials/RQt-Port-Plugin-Windows': 'https://docs.ros.org/en/foxy/Tutorials/RQt-Port-Plugin-Windows.html',
'Tutorials/RQt-Source-Install-MacOS': 'https://docs.ros.org/en/foxy/Guides/RQt-Source-Install-MacOS.html',
'Tutorials/RQt-Source-Install': 'https://docs.ros.org/en/foxy/Guides/RQt-Source-Install.html',
'Tutorials/RQt-Source-Install-Windows10': 'https://docs.ros.org/en/foxy/Guides/RQt-Source-Install-Windows10.html',
'Tutorials/Run-2-nodes-in-a-single-docker-container': 'https://docs.ros.org/en/foxy/Tutorials/Run-2-nodes-in-a-single-docker-container.html',
'Tutorials/Run-2-nodes-in-two-separate-docker-containers': 'https://docs.ros.org/en/foxy/Tutorials/Run-2-nodes-in-two-separate-docker-containers.html',
'Tutorials/Services/Understanding-ROS2-Services': 'https://docs.ros.org/en/foxy/Tutorials/Services/Understanding-ROS2-Services.html',
'Tutorials/Single-Package-Define-And-Use-Interface': 'https://docs.ros.org/en/foxy/Tutorials/Single-Package-Define-And-Use-Interface.html',
'Tutorials/Sync-Vs-Async': 'https://docs.ros.org/en/foxy/Tutorials/Sync-Vs-Async.html',
'Tutorials/tf2': 'https://docs.ros.org/en/foxy/Tutorials/tf2.html',
'Tutorials/Topics/Topic-Statistics-Tutorial': 'https://docs.ros.org/en/foxy/Tutorials/Topics/Topic-Statistics-Tutorial.html',
'Tutorials/Topics/Understanding-ROS2-Topics': 'https://docs.ros.org/en/foxy/Tutorials/Topics/Understanding-ROS2-Topics.html',
'Tutorials/Turtlesim/Introducing-Turtlesim': 'https://docs.ros.org/en/foxy/Tutorials/Turtlesim/Introducing-Turtlesim.html',
'Tutorials/Understanding-ROS2-Actions': 'https://docs.ros.org/en/foxy/Tutorials/Understanding-ROS2-Actions.html',
'Tutorials/Understanding-ROS2-Nodes': 'https://docs.ros.org/en/foxy/Tutorials/Understanding-ROS2-Nodes.html',
'Tutorials/URDF/Using-URDF-with-Robot-State-Publisher': 'https://docs.ros.org/en/foxy/Tutorials/URDF/Using-URDF-with-Robot-State-Publisher.html',
'Tutorials/Using-Parameters-In-A-Class-CPP': 'https://docs.ros.org/en/foxy/Tutorials/Using-Parameters-In-A-Class-CPP.html',
'Tutorials/Using-Parameters-In-A-Class-Python': 'https://docs.ros.org/en/foxy/Tutorials/Using-Parameters-In-A-Class-Python.html',
'Tutorials/Using-Python-Packages': 'https://docs.ros.org/en/foxy/Tutorials/Using-Python-Packages.html',
'Tutorials/Working-with-multiple-RMW-implementations': 'https://docs.ros.org/en/foxy/Tutorials/Working-with-multiple-RMW-implementations.html',
'Tutorials/Workspace/Creating-A-Workspace': 'https://docs.ros.org/en/foxy/Tutorials/Workspace/Creating-A-Workspace.html',
'Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber': 'https://docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html',
'Tutorials/Writing-A-Simple-Cpp-Service-And-Client': 'https://docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Cpp-Service-And-Client.html',
'Tutorials/Writing-A-Simple-Py-Publisher-And-Subscriber': 'https://docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Py-Publisher-And-Subscriber.html',
'Tutorials/Writing-A-Simple-Py-Service-And-Client': 'https://docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Py-Service-And-Client.html',
}
class RedirectFrom(Directive):
has_content = True
template_name = 'layout.html'
redirections = {}
@classmethod
def register(cls, app):
app.connect('html-collect-pages', cls.generate)
app.add_directive('redirect-from', cls)
return app
@classmethod
def generate(cls, app):
from sphinx.builders.html import StandaloneHTMLBuilder
if not isinstance(app.builder, StandaloneHTMLBuilder):
return
redirect_html_fragment = """
<link rel="canonical" href="{url}" />
<meta http-equiv="refresh" content="0; url={url}" />
<script>
window.location.href = '{url}';
</script>
"""
redirections = {
os.path.splitext(os.path.relpath(
document_path, app.srcdir
))[0]: redirect_urls
for document_path, redirect_urls in cls.redirections.items()
}
redirection_conflict = next((
(canon_1, canon_2, redirs_1.intersection(redirs_2))
for (canon_1, redirs_1), (canon_2, redirs_2)
in itertools.combinations(redirections.items(), 2)
if redirs_1.intersection(redirs_2)
), None)
if redirection_conflict:
canonical_url_1, canonical_url_2 = redirection_conflict[:2]
conflicting_redirect_urls = redirection_conflict[-1]
raise RuntimeError(
'Documents {} and {} define conflicting redirects: {}'.format(
canonical_url_1, canonical_url_2, conflicting_redirect_urls
)
)
all_canonical_urls = set(redirections.keys())
all_redirect_urls = {
redirect_url
for redirect_urls in redirections.values()
for redirect_url in redirect_urls
}
conflicting_urls = all_canonical_urls.intersection(all_redirect_urls)
if conflicting_urls:
raise RuntimeError(
'Some redirects conflict with existing documents: {}'.format(
conflicting_urls
)
)
for canonical_url, redirect_urls in redirections.items():
for redirect_url in redirect_urls:
context = {
'canonical_url': os.path.relpath(
canonical_url, redirect_url
),
'title': os.path.basename(redirect_url),
'metatags': redirect_html_fragment.format(
url=app.builder.get_relative_uri(
redirect_url, canonical_url
)
)
}
yield (redirect_url, context, cls.template_name)
def run(self):
document_path = self.state.document.current_source
if document_path not in RedirectFrom.redirections:
RedirectFrom.redirections[document_path] = set()
RedirectFrom.redirections[document_path].update(self.content)
return []
def make_router(origin, destination):
def _missing_reference(app, env, node, contnode):
from docutils import nodes
from docutils.utils import relative_path
from sphinx.util import docname_join
doctarget = docname_join(node['refdoc'], node['reftarget'])
if doctarget.startswith(origin):
routed_doctarget = doctarget.replace(origin, destination)
if routed_doctarget in env.all_docs:
newnode = nodes.reference(
'', contnode.astext(), internal=True
)
newnode['refuri'] = app.builder.get_relative_uri(
node['refdoc'], routed_doctarget
)
return newnode
return _missing_reference
def apply_redirects(app, exception):
redirects = app.config['redirects']
if not redirects:
return
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinxcontrib.serializinghtml import JSONHTMLBuilder
if isinstance(app.builder, JSONHTMLBuilder):
# If the builder is the JSONHTMLBuilder, then to support redirects from
# the https://github.com/ros-infrastructure/rosindex site, we need to
# add a 'canonical_url' portion to the JSON. When that is in place, the
# site generator will automatically use that as a redirect.
for source, target in redirects.items():
# examine if it matches to some doc
for doc in app.env.found_docs:
if fnmatch(doc, source):
file_path = Path(app.outdir).joinpath(doc).with_suffix('.fjson')
with open(file_path, 'r') as infp:
data = json.load(infp)
data['canonical_url'] = target
with open(file_path, 'w') as outfp:
json.dump(data, outfp)
elif isinstance(app.builder, StandaloneHTMLBuilder):
# If the builder is the StandaloneHTMLBuilder, we just assume that the
# user meant to generate an HTML file and do that here.
# The below code is a lightly-modified version of the code at
# https://gitlab.com/documatt/sphinx-reredirects . It is licensed as BSD.
# HTML used as redirect file content
redirect_template = '<html><head><meta http-equiv="refresh" content="0; url=${to_uri}"></head></html>'
# For each entry
for source, target in redirects.items():
# examine if it matches to some doc
for doc in app.env.found_docs:
if fnmatch(doc, source):
# if so, apply $source placeholder
new_target = Template(target).substitute({'source': doc})
# create redirect file
redirect_file_path = Path(app.outdir).joinpath(doc).with_suffix('.html')
content = Template(redirect_template).substitute({'to_uri': new_target})
redirect_file_path.write_text(content)
else:
print('Only JSON and HTML builders support redirects')
def copy_downloadable_files(app, exception):
for source, dest in app.config.custom_copy_files.items():
source_path = os.path.join(app.srcdir, source)
dest_path = os.path.join(app.outdir, dest)
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
shutil.copyfile(source_path, dest_path)
def setup(app):
RedirectFrom.register(app)
app.connect('build-finished', apply_redirects)
app.add_config_value('redirects', {}, 'env')
app.connect('build-finished', copy_downloadable_files)
app.add_config_value('custom_copy_files', {}, 'env')
app.connect('missing-reference', make_router(
'Installation', 'Installation/Eloquent'
))