From 7cea759377db9f2a59ace4809202c3625b1ca874 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sat, 21 Apr 2018 20:40:52 +0200 Subject: [PATCH] add a little note at the bottom of the page --- src/Literate.jl | 13 +++++++++++++ test/runtests.jl | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Literate.jl b/src/Literate.jl index 5428c85..acd066c 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -121,6 +121,19 @@ function replace_default(content, sym; ) repls = Pair{Any,Any}[] + # add some shameless advertisement + if sym === :jl + content *= """ + #- + # This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl + """ + else + content *= """ + #- + #' *This $(sym === :md ? "page" : "notebook") was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* + """ + end + push!(repls, "\r\n" => "\n") # normalize line endings if sym === :md diff --git a/test/runtests.jl b/test/runtests.jl index 3de94f8..2fe8c02 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -209,6 +209,8 @@ content = """ # PLACEHOLDER3 # PLACEHOLDER4 + # This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl + """ script = read(joinpath(outdir, "inputfile.jl"), String) @test script == expected_script @@ -319,6 +321,8 @@ end \\int f(x) dx ``` + *This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* + """ markdown = read(joinpath(outdir, "inputfile.md"), String) @test markdown == expected_markdown @@ -465,6 +469,12 @@ end "\\\\int f(x) dx\\n", "\\\\end{equation}" ] + """, + + """ + "source": [ + "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" + ] """)) notebook = read(joinpath(outdir, "inputfile.ipynb"), String)