294
294
)
295
295
end
296
296
297
+ const output_path = joinpath (buildroot, " doc" , " _build" , (render_pdf ? " pdf" : " html" ), " en" )
297
298
makedocs (
298
- build = joinpath (buildroot, " doc " , " _build " , (render_pdf ? " pdf " : " html " ), " en " ) ,
299
+ build = output_path ,
299
300
modules = [Main, Base, Core, [Base. root_module (Base, stdlib. stdlib) for stdlib in STDLIB_DOCS]. .. ],
300
301
clean = true ,
301
302
doctest = (" doctest=fix" in ARGS ) ? (:fix ) : (" doctest=only" in ARGS ) ? (:only ) : (" doctest=true" in ARGS ) ? true : false ,
@@ -309,6 +310,31 @@ makedocs(
309
310
pages = PAGES,
310
311
)
311
312
313
+ # Update URLs to external stdlibs (JuliaLang/julia#43199)
314
+ for (root, _, files) in walkdir (output_path), file in joinpath .(root, files)
315
+ endswith (file, " .html" ) || continue
316
+ str = read (file, String)
317
+ # Index page links, update
318
+ # https://github.com/JuliaLang/julia/blob/master/stdlib/${STDLIB_NAME}-${STDLIB_COMMIT}/path/to.md
319
+ # to
320
+ # https://github.com/JuliaLang/${STDLIB_NAME}.jl/blob/master/docs/src/index.md
321
+ str = replace (str, r" https://github.com/JuliaLang/julia/blob/master/stdlib/(.*)-\w {40}/(.*\. md)" =>
322
+ s " https://github.com/JuliaLang/\1 .jl/blob/master/\2 " )
323
+ # Link to source links, update
324
+ # https://github.com/JuliaLang/julia/blob/${JULIA_COMMIT}/stdlib/${STDLIB_NAME}-${STDLIB_COMMIT}/path/to.jl#${LINES}
325
+ # to
326
+ # https://github.com/JuliaLang/${STDLIB_NAME}.jl/blob/${STDLIB_COMMIT}/path/to.jl#${LINES}
327
+ str = replace (str, r" https://github\. com/JuliaLang/julia/blob/\w {40}/stdlib/(.*)-(\w {40})/(.*\. jl#L\d +(?:-L\d +)?)" =>
328
+ s " https://github.com/JuliaLang/\1 .jl/blob/\2 /\3 " )
329
+ # Some stdlibs are not hosted by JuliaLang
330
+ str = replace (str, r" (https://github\. com)/JuliaLang/(ArgTools\. jl/blob)" => s "\1 /JuliaIO/\2 " )
331
+ str = replace (str, r" (https://github\. com)/JuliaLang/(LibCURL\. jl/blob)" => s "\1 /JuliaWeb/\2 " )
332
+ str = replace (str, r" (https://github\. com)/JuliaLang/(SHA\. jl/blob)" => s "\1 /JuliaCrypto/\2 " )
333
+ str = replace (str, r" (https://github\. com)/JuliaLang/(Tar\. jl/blob)" => s "\1 /JuliaIO/\2 " )
334
+ # Write back to the file
335
+ write (file, str)
336
+ end
337
+
312
338
# Define our own DeployConfig
313
339
struct BuildBotConfig <: Documenter.DeployConfig end
314
340
function Documenter. deploy_folder (:: BuildBotConfig ; devurl, repo, branch, kwargs... )
0 commit comments