@@ -181,6 +181,32 @@ function make_output_structure(docs::Vector{MultiDocRef}, prettyurls)
181
181
return dir
182
182
end
183
183
184
+ function insert_multidocref_html! (navitems, doc, dir, thispagepath, prettyurls)
185
+ path = joinpath (dir, doc. path)
186
+ if ! isfile (joinpath (path, " index.html" ))
187
+ stable = joinpath (path, " stable" )
188
+ dev = joinpath (path, " dev" )
189
+ if isfile (joinpath (stable, " index.html" ))
190
+ path = stable
191
+ elseif isfile (joinpath (dev, " index.html" ))
192
+ path = dev
193
+ end
194
+ end
195
+ rp = relpath (path, thispagepath)
196
+ a = Gumbo. HTMLElement {:a} (
197
+ [],
198
+ navitems,
199
+ Dict (
200
+ " href" => string (rp, prettyurls ? " /" : " /index.html" ),
201
+ " class" =>
202
+ startswith (thispagepath, joinpath (dir, doc. path, " " )) ? # need to force a trailing pathsep here
203
+ " nav-link active nav-item" : " nav-link nav-item" ,
204
+ ),
205
+ )
206
+ push! (a. children, Gumbo. HTMLText (a, doc. name))
207
+ push! (navitems. children, a)
208
+ end
209
+
184
210
function make_global_nav (
185
211
dir,
186
212
docs:: Vector ,
@@ -221,19 +247,7 @@ function make_global_nav(
221
247
222
248
for doc in docs
223
249
if doc isa MultiDocRef
224
- rp = relpath (joinpath (dir, doc. path), thispagepath)
225
- a = Gumbo. HTMLElement {:a} (
226
- [],
227
- navitems,
228
- Dict (
229
- " href" => string (rp, prettyurls ? " /" : " /index.html" ),
230
- " class" =>
231
- startswith (thispagepath, joinpath (dir, doc. path, " " )) ? # need to force a trailing pathsep here
232
- " nav-link active nav-item" : " nav-link nav-item" ,
233
- ),
234
- )
235
- push! (a. children, Gumbo. HTMLText (a, doc. name))
236
- push! (navitems. children, a)
250
+ insert_multidocref_html! (navitems, doc, dir, thispagepath, prettyurls)
237
251
else # doc isa DropdownNav
238
252
div = Gumbo. HTMLElement {:div} (
239
253
[],
@@ -248,20 +262,8 @@ function make_global_nav(
248
262
push! (navitems. children, div)
249
263
250
264
for doc in doc. children
251
- rp = relpath (joinpath (dir, doc. path), thispagepath)
252
265
li = Gumbo. HTMLElement {:li} ([], ul, Dict ())
253
- a = Gumbo. HTMLElement {:a} (
254
- [],
255
- li,
256
- Dict (
257
- " href" => string (rp, prettyurls ? " /" : " /index.html" ),
258
- " class" =>
259
- startswith (thispagepath, joinpath (dir, doc. path, " " )) ? # need to force a trailing pathsep here
260
- " nav-link active nav-item" : " nav-link nav-item" ,
261
- ),
262
- )
263
- push! (a. children, Gumbo. HTMLText (a, doc. name))
264
- push! (li. children, a)
266
+ insert_multidocref_html! (li, doc, dir, thispagepath, prettyurls)
265
267
push! (ul. children, li)
266
268
end
267
269
end
0 commit comments