From a607c252e1f24d0b7b6793700538861d6505c861 Mon Sep 17 00:00:00 2001 From: Jay-sanjay <134289328+Jay-sanjay@users.noreply.github.com> Date: Tue, 16 Jan 2024 11:42:17 +0530 Subject: [PATCH] weaving for edit button --- src/JSOTutorials.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/JSOTutorials.jl b/src/JSOTutorials.jl index 7dfe5fe..8f61de2 100644 --- a/src/JSOTutorials.jl +++ b/src/JSOTutorials.jl @@ -69,6 +69,22 @@ function weave_all(build_list = default_builds) folder == "test.jmd" && continue weave_folder(folder, build_list) end + + tutorial_files = readdir("tutorials") + for tutorial_file in tutorial_files + + tutorial_path = joinpath("tutorials", tutorial_file) + + github_url = "https://github.com/JuliaSmoothOptimizers/JSOTutorials.jl/tree/main/tutorials" * tutorial_path + footer = "\n\n---\n[Edit this page on GitHub]($github_url)" + + tutorial_content = read(tutorial_path, String) + write(tutorial_path, tutorial_content * footer) + + # Weave the tutorial + weave(tutorial_path) + end + end function weave_folder(folder, build_list = default_builds)