@@ -98,3 +98,44 @@ html_theme_options = {
98
98
# relative to this directory. They are copied after the builtin static files,
99
99
# so a file named "default.css" will overwrite the builtin "default.css".
100
100
# html_static_path = ['_static']
101
+
102
+ # When the cmake DPCTL_USE_MULTIVERSION_TEMPLATE flag is set we generate
103
+ # links in the sidebar to the documentation for older versions of dpctl.
104
+ # Note that ths option does not actually generate the documentation for
105
+ # older versions, it only adds links in the sidebar to earlier versions of
106
+ # the documentation. All earlier versions of the documentation should be
107
+ # generated and pushed to the gh-pages branch manually, after which the
108
+ # doc_versions.txt should be updated.
109
+
110
+ generate_multiversion = "@DPCTL_USE_MULTIVERSION_TEMPLATE@"
111
+
112
+ if generate_multiversion == "ON" :
113
+ try :
114
+ html_context
115
+ except NameError :
116
+ html_context = dict ()
117
+ html_context ["display_lower_left" ] = True
118
+ templates_path = ["_templates" ]
119
+ html_context ["current_version" ] = version
120
+ html_context ["version" ] = version
121
+
122
+ # POPULATE LINKS TO OTHER VERSIONS
123
+ html_context ["versions" ] = list ()
124
+
125
+ # Populate the list of documented versions from the doc_versions.tx
126
+ versions = []
127
+ with open ("doc_versions.txt" , "r" ) as doc_versions :
128
+ while True :
129
+ version = doc_versions .readline ().strip ()
130
+ if not version :
131
+ break
132
+ elif len (version ):
133
+ versions .append (version )
134
+
135
+ # FIXME: Remove this hard coding
136
+ DOC_SITE_NAME = "https://intelpython.github.io/dpctl/"
137
+
138
+ for version in versions :
139
+ html_context ["versions" ].append (
140
+ (version , DOC_SITE_NAME + version + "/index.html" )
141
+ )
0 commit comments