about summary refs log tree commit diff homepage
path: root/_assets/scripts/generate_results.jl
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-03-07 11:29:26 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-03-07 11:29:26 +0700
commit3e6f0389f0cdac7b90970c49f455205563b48ad6 (patch)
tree4e4f0a018b1aae2276767f7f8da75fb4c909e772 /_assets/scripts/generate_results.jl
downloadsite-3e6f0389f0cdac7b90970c49f455205563b48ad6.tar.gz
Initialize a Franklin site
Diffstat (limited to '_assets/scripts/generate_results.jl')
-rw-r--r--_assets/scripts/generate_results.jl27
1 files changed, 27 insertions, 0 deletions
diff --git a/_assets/scripts/generate_results.jl b/_assets/scripts/generate_results.jl
new file mode 100644
index 0000000..8823354
--- /dev/null
+++ b/_assets/scripts/generate_results.jl
@@ -0,0 +1,27 @@
+# Parent file to run all scripts which may generate
+# some output that you want to display on the website.
+# this can be used as a tester to check that all the code
+# on your website runs properly.
+
+dir = @__DIR__
+
+"""
+    genplain(s)
+
+Small helper function to run some code and redirect the output (stdout) to a file.
+"""
+function genplain(s::String)
+    open(joinpath(dir, "output", "$(splitext(s)[1]).txt"), "w") do outf
+        redirect_stdout(outf) do
+            include(joinpath(dir, s))
+        end
+    end
+end
+
+# output
+
+genplain("script1.jl")
+
+# plots
+
+include("script2.jl")