Skip to content

Commit 80b6816

Browse files
authoredJun 20, 2022
Update generation of examples, fixes #856 (#862)
1 parent 00aa294 commit 80b6816

File tree

2 files changed

+9
-394
lines changed

2 files changed

+9
-394
lines changed
 

‎docs/make.jl

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Loops through the files in the examples folder and adds them (with any header co
55
markdown file.
66
"""
77
function generateExamples()
8-
f = open(joinpath(@__DIR__, "src/examples.md"), "w")
8+
f = IOBuffer()
99
write(
1010
f,
1111
"```@meta
@@ -66,7 +66,14 @@ function generateExamples()
6666
close(opened)
6767
end
6868
end
69-
close(f)
69+
file = joinpath(@__DIR__, "src/examples.md")
70+
current_content = isfile(file) ? read(file, String) : ""
71+
updated_content = String(take!(f))
72+
# Only update content if something changed so that the file watcher in
73+
# LiveServer.jl isn't triggering itself when running make.jl.
74+
if updated_content != current_content
75+
write(file, updated_content)
76+
end
7077
end
7178

7279
generateExamples()

‎docs/src/examples.md

-392
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.