Skip to content

Weaving for edit on github button #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/JSOTutorials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tutorial is already woven when weave_folder is called above, so this is weaving twice, which is slow.
Instead, this footer can be added in weave_file. The original code came from SciML tutorials, and I think that is how they do it there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jay-sanjay, you marked this as resolved and re-requested a review. This is not resolved. Also, as you mentioned in your comment, the .md file doesn't have the "Edit this on Github", so your solution is apparently not working.
Let me know if you need some clarification, thanks.

end

end

function weave_folder(folder, build_list = default_builds)
Expand Down