diff --git a/.travis.yml b/.travis.yml index fc6584e..afeadb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,6 @@ git: depth: 99999999 after_success: # build docs - - julia -e 'Pkg.add("Documenter"); Pkg.checkout("Documenter"); cd(Pkg.dir("Examples")); include("docs/make.jl")' + - julia -e 'Pkg.add("Documenter"); Pkg.checkout("Documenter"); cd(Pkg.dir("Literate")); include("docs/make.jl")' # push coverage results to Codecov - - julia -e 'cd(Pkg.dir("Examples")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + - julia -e 'cd(Pkg.dir("Literate")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/LICENSE.md b/LICENSE.md index dd30ae7..07ca3f9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -The Examples.jl package is licensed under the MIT "Expat" License: +The Literate.jl package is licensed under the MIT "Expat" License: > Copyright (c) 2018: Fredrik Ekre. > diff --git a/README.md b/README.md index 1be30c3..42edd9d 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# Examples +# Literate | **Documentation** | **Build Status** | |:--------------------------------------- |:----------------------------------------------------------------------------------------------- | | [![][docs-latest-img]][docs-latest-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][codecov-img]][codecov-url] | -`Examples.jl` is a package that, based on a single source file, generates markdown, +`Literate.jl` is a package that, based on a single source file, generates markdown, for e.g. [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl), [Jupyter notebooks](http://jupyter.org/) and uncommented scripts for documentation of your package. [docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg -[docs-latest-url]: https://fredrikekre.github.io/Examples.jl/latest/ +[docs-latest-url]: https://fredrikekre.github.io/Literate.jl/latest/ [docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg -[docs-stable-url]: https://fredrikekre.github.io/Examples.jl/stable +[docs-stable-url]: https://fredrikekre.github.io/Literate.jl/stable -[travis-img]: https://travis-ci.org/fredrikekre/Examples.jl.svg?branch=master -[travis-url]: https://travis-ci.org/fredrikekre/Examples.jl +[travis-img]: https://travis-ci.org/fredrikekre/Literate.jl.svg?branch=master +[travis-url]: https://travis-ci.org/fredrikekre/Literate.jl [appveyor-img]: https://ci.appveyor.com/api/projects/status/xe0ghtyas12wv555/branch/master?svg=true -[appveyor-url]: https://ci.appveyor.com/project/fredrikekre/Examples-jl/branch/master +[appveyor-url]: https://ci.appveyor.com/project/fredrikekre/Literate-jl/branch/master -[codecov-img]: https://codecov.io/gh/fredrikekre/Examples.jl/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/fredrikekre/Examples.jl +[codecov-img]: https://codecov.io/gh/fredrikekre/Literate.jl/branch/master/graph/badge.svg +[codecov-url]: https://codecov.io/gh/fredrikekre/Literate.jl diff --git a/appveyor.yml b/appveyor.yml index ae78cd8..2c14a8b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,7 +39,7 @@ build_script: # Need to convert from shallow to complete for Pkg.clone to work - IF EXIST .git\shallow (git fetch --unshallow) - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"Examples\"); Pkg.build(\"Examples\")" + Pkg.clone(pwd(), \"Literate\"); Pkg.build(\"Literate\")" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"Examples\")" + - C:\projects\julia\bin\julia -e "Pkg.test(\"Literate\")" diff --git a/docs/make.jl b/docs/make.jl index 020b369..8eddb3c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,18 +1,18 @@ using Documenter -using Examples +using Literate # generate examples EXAMPLE = joinpath(@__DIR__, "..", "examples", "example.jl") OUTPUT = joinpath(@__DIR__, "src/generated") -Examples.markdown(EXAMPLE, OUTPUT) -Examples.notebook(EXAMPLE, OUTPUT) -Examples.script(EXAMPLE, OUTPUT) +Literate.markdown(EXAMPLE, OUTPUT) +Literate.notebook(EXAMPLE, OUTPUT) +Literate.script(EXAMPLE, OUTPUT) makedocs( - modules = [Examples], + modules = [Literate], format = :html, - sitename = "Examples.jl", + sitename = "Literate.jl", pages = Any[ "index.md", "fileformat.md", @@ -24,7 +24,7 @@ makedocs( ) deploydocs( - repo = "github.com/fredrikekre/Examples.jl.git", + repo = "github.com/fredrikekre/Literate.jl.git", target = "build", deps = nothing, make = nothing diff --git a/docs/src/customprocessing.md b/docs/src/customprocessing.md index 965b780..3faa183 100644 --- a/docs/src/customprocessing.md +++ b/docs/src/customprocessing.md @@ -5,12 +5,12 @@ to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing [line filtering](@ref Filtering-lines) there might be situations where you need -to manually hook into the generation and change things. In `Examples.jl` this +to manually hook into the generation and change things. In `Literate.jl` this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content. -All of the generators ([`Examples.markdown`](@ref), [`Examples.notebook`](@ref) -and [`Examples.script`](@ref)) accepts `preprocess` and `postprocess` keyword +All of the generators ([`Literate.markdown`](@ref), [`Literate.notebook`](@ref) +and [`Literate.script`](@ref)) accepts `preprocess` and `postprocess` keyword arguments. The default "transformation" is the `identity` function. The input to the transformation functions is a `String`, and the output should be the transformed `String`. @@ -43,5 +43,5 @@ end which would replace every occurrence of `"DATEOFTODAY"` with the current date. We would now simply give this function to the generator, for example: ```julia -Examples.markdown("input.jl", "outputdir"; preprocess = update_date) +Literate.markdown("input.jl", "outputdir"; preprocess = update_date) ``` diff --git a/docs/src/documenter.md b/docs/src/documenter.md index 58e2634..bb3f2df 100644 --- a/docs/src/documenter.md +++ b/docs/src/documenter.md @@ -1,14 +1,14 @@ # [**6.** Interaction with Documenter.jl](@id Interaction-with-Documenter) -`Examples.jl` can be used for any purpose, it spits out regular markdown files, +`Literate.jl` can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation -for your package. The generators ([`Examples.markdown`](@ref), [`Examples.notebook`](@ref) -and [`Examples.script`](@ref)) supports a keyword argument `documenter` that lets +for your package. The generators ([`Literate.markdown`](@ref), [`Literate.notebook`](@ref) +and [`Literate.script`](@ref)) supports a keyword argument `documenter` that lets the generator perform some extra things, keeping in mind that the generated files will, eventually, be used with Documenter.jl. So lets take a look at what will happen if we set `documenter = true`: -[`Examples.markdown`](@ref): +[`Literate.markdown`](@ref): - The default code fence will change from ```` ```julia @@ -30,7 +30,7 @@ if we set `documenter = true`: ``` ```` -[`Examples.notebook`](@ref): +[`Literate.notebook`](@ref): - Documenter style `@ref`s and `@id` will be removed. This means that you can use `@ref` and `@id` in the source file without them leaking to the notebook. - Documenter style markdown math diff --git a/docs/src/fileformat.md b/docs/src/fileformat.md index 1d08253..050442d 100644 --- a/docs/src/fileformat.md +++ b/docs/src/fileformat.md @@ -1,6 +1,6 @@ # **2.** File Format -The source file format for `Examples.jl` is a regular, commented, julia (`.jl`) scripts. +The source file format for `Literate.jl` is a regular, commented, julia (`.jl`) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. `include`, to make sure the examples stay up do date with other changes in your package. @@ -36,7 +36,7 @@ julia code. We note a couple of things: For simple use this is all you need to know, the script above is valid. Let's take a look at what the above snippet would generate, with default settings: -- [`Examples.markdown`](@ref): leading `#'` are removed, and code lines are wrapped in +- [`Literate.markdown`](@ref): leading `#'` are removed, and code lines are wrapped in `@example`-blocks: ````markdown # Rational numbers @@ -56,7 +56,7 @@ at what the above snippet would generate, with default settings: ``` ```` -- [`Examples.notebook`](@ref): leading `#'` are removed, markdown lines are placed in +- [`Literate.notebook`](@ref): leading `#'` are removed, markdown lines are placed in `"markdown"` cells, and code lines in `"code"` cells: ``` │ # Rational numbers @@ -76,7 +76,7 @@ at what the above snippet would generate, with default settings: Out [2]: │ 11//15 ``` -- [`Examples.script`](@ref): all lines starting with `#'` are removed: +- [`Literate.script`](@ref): all lines starting with `#'` are removed: ```julia x = 1//3 y = 2//5 @@ -101,9 +101,9 @@ since `@docs` is Documenter syntax that the notebook will not understand. This is a case where we can prepend `#md` to those lines: ````julia #md #' ```@docs -#md #' Examples.markdown -#md #' Examples.notebook -#md #' Examples.markdown +#md #' Literate.markdown +#md #' Literate.notebook +#md #' Literate.markdown #md #' ``` ```` The lines in the example above would be filtered out in the preprocessing step, unless we are diff --git a/docs/src/index.md b/docs/src/index.md index a8aa3a6..907ddac 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,11 +1,11 @@ # **1.** Introduction -Welcome to the documentation for `Examples.jl`. A simplistic package +Welcome to the documentation for `Literate.jl`. A simplistic package to help you organize examples for you package documentation. ### What? -`Examples.jl` is a package that, based on a single source file, generates markdown, +`Literate.jl` is a package that, based on a single source file, generates markdown, for e.g. [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl), [Jupyter notebooks](http://jupyter.org/) and uncommented scripts for documentation of your package. @@ -15,20 +15,20 @@ be simple. In short all you have to do is to write a commented julia script! The package consists mainly of three functions, which all takes the same script file as input, but generates different output: -- [`Examples.markdown`](@ref): generates a markdown file -- [`Examples.notebook`](@ref): generates an (optionally executed) notebook -- [`Examples.script`](@ref): generates a plain script file, removing everything +- [`Literate.markdown`](@ref): generates a markdown file +- [`Literate.notebook`](@ref): generates an (optionally executed) notebook +- [`Literate.script`](@ref): generates a plain script file, removing everything that is not code ### Why? -Examples are (probably) the best way to showcase your awesome package, and examples +Literate are (probably) the best way to showcase your awesome package, and examples are often the best way for a new user to learn how to use it. It is therefore important that the documentation of your package contains examples for users to read and study. However, people are different, and we all prefer different ways of trying out a new package. Some people wants to RTFM, others want to explore the package interactively in, for example, a notebook, and some people wants to study the source code. The aim of -`Examples.jl` is to make it easy to give the user all of these options, while still +`Literate.jl` is to make it easy to give the user all of these options, while still keeping maintenance to a minimum. It is quite common that packages have "example notebooks" to showcase the package. @@ -42,8 +42,8 @@ by using [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl) `@example`- This is also great, but it is not quite as interactive as a notebook, for the users who prefer that. -`Examples.jl` tries to solve the problems above by creating the output as a part of the doc -build. `Examples.jl` generates the output from a single source file which makes it easier to +`Literate.jl` tries to solve the problems above by creating the output as a part of the doc +build. `Literate.jl` generates the output from a single source file which makes it easier to maintain, test, and keep the manual and your example notebooks in sync. ### How? diff --git a/docs/src/outputformats.md b/docs/src/outputformats.md index 836f19e..5b9359a 100644 --- a/docs/src/outputformats.md +++ b/docs/src/outputformats.md @@ -33,18 +33,18 @@ y = x.^2 - x ```` ```@docs -Examples.markdown +Literate.markdown ``` ## [**4.2.** Notebook output](@id Notebook-output) ```@docs -Examples.notebook +Literate.notebook ``` ## [**4.3.** Script output](@id Script-output) ```@docs -Examples.script +Literate.script ``` diff --git a/examples/example.jl b/examples/example.jl index 5586b24..2c5f2c3 100644 --- a/examples/example.jl +++ b/examples/example.jl @@ -1,6 +1,6 @@ #' # **7.** Example #' -#' This is an example for Examples.jl. +#' This is an example for Literate.jl. #' The source file can be found [here](@__REPO_ROOT_URL__examples/example.jl). #' The generated markdown can be found here: [`example.md`](./example.md), the #' generated notebook can be found here: diff --git a/src/Examples.jl b/src/Literate.jl similarity index 98% rename from src/Examples.jl rename to src/Literate.jl index fb67add..d291872 100644 --- a/src/Examples.jl +++ b/src/Literate.jl @@ -1,4 +1,4 @@ -module Examples +module Literate import Compat: replace, popfirst!, @error, @info @@ -92,7 +92,7 @@ end filename(str) = first(splitext(last(splitdir(str)))) """ - Examples.script(inputfile, outputdir; kwargs...) + Literate.script(inputfile, outputdir; kwargs...) Generate a plain script file from `inputfile` and write the result to `outputdir`. @@ -160,7 +160,7 @@ function script(inputfile, outputdir; preprocess = identity, postprocess = ident end """ - Examples.markdown(inputfile, outputdir; kwargs...) + Literate.markdown(inputfile, outputdir; kwargs...) Generate a markdown file from `inputfile` and write the result to the directory`outputdir`. @@ -270,7 +270,7 @@ end const JUPYTER_VERSION = v"4.3.0" """ - Examples.notebook(inputfile, outputdir; kwargs...) + Literate.notebook(inputfile, outputdir; kwargs...) Generate a notebook from `inputfile` and write the result to `outputdir`. diff --git a/test/runtests.jl b/test/runtests.jl index e4e18ce..313b1cc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ -import Examples -import Examples: Chunk, MDChunk, CodeChunk +import Literate +import Literate: Chunk, MDChunk, CodeChunk using Compat.Test # compare content of two parsed chunk vectors @@ -22,7 +22,7 @@ function compare_chunks(chunks1, chunks2) end end -@testset "Examples.parse" begin +@testset "Literate.parse" begin content = """ #' Line 1 Line 2 @@ -112,7 +112,7 @@ end CodeChunk(["#Line 49", "Line 50"], false), MDChunk(["Line 53"]), ] - parsed_chunks = Examples.parse(content) + parsed_chunks = Literate.parse(content) compare_chunks(parsed_chunks, expected_chunks) # test leading/trailing whitespace removal @@ -131,7 +131,7 @@ end foreach(x -> println(iows), 1:rand(2:5)) end - compare_chunks(Examples.parse(String(take!(io))), Examples.parse(String(take!(iows)))) + compare_chunks(Literate.parse(String(take!(io))), Literate.parse(String(take!(iows)))) end # testset parser @@ -170,7 +170,7 @@ content = """ #' ``` """ -@testset "Examples.script" begin +@testset "Literate.script" begin mktempdir(@__DIR__) do sandbox cd(sandbox) do # write content to inputfile @@ -179,10 +179,10 @@ content = """ outdir = mktempdir(pwd()) # test defaults - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "v1.2.0", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.script(inputfile, outdir) + Literate.script(inputfile, outdir) end expected_script = """ x = 1 @@ -198,9 +198,9 @@ content = """ end - # Link to repo root: https://github.com/fredrikekre/Examples.jl/blob/master/ + # Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/ - # Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Examples.jl/blob/gh-pages/v1.2.0/ + # Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/ # PLACEHOLDER3 # PLACEHOLDER4 @@ -210,16 +210,16 @@ content = """ @test script == expected_script # no tag -> latest directory - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.script(inputfile, outdir) + Literate.script(inputfile, outdir) end script = read(joinpath(outdir, "inputfile.jl"), String) - @test contains(script, "fredrikekre/Examples.jl/blob/gh-pages/latest/") + @test contains(script, "fredrikekre/Literate.jl/blob/gh-pages/latest/") # pre- and post-processing - Examples.script(inputfile, outdir, + Literate.script(inputfile, outdir, preprocess = x -> replace(x, "PLACEHOLDER3" => "3REDLOHECALP"), postprocess = x -> replace(x, "PLACEHOLDER4" => "4REDLOHECALP")) script = read(joinpath(outdir, "inputfile.jl"), String) @@ -231,13 +231,13 @@ content = """ @test contains(script, "4REDLOHECALP") # name - Examples.script(inputfile, outdir, name = "foobar") + Literate.script(inputfile, outdir, name = "foobar") @test isfile(joinpath(outdir, "foobar.jl")) end end end -@testset "Examples.markdown" begin +@testset "Literate.markdown" begin mktempdir(@__DIR__) do sandbox cd(sandbox) do # write content to inputfile @@ -246,14 +246,14 @@ end outdir = mktempdir(pwd()) # test defaults - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "v1.2.0", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.markdown(inputfile, outdir) + Literate.markdown(inputfile, outdir) end expected_markdown = """ ```@meta - EditURL = "https://github.com/fredrikekre/Examples.jl/blob/master/test/$(basename(sandbox))/inputfile.jl" + EditURL = "https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl" ``` # [Example](@id example-id) @@ -282,16 +282,16 @@ end end ``` - Link to repo root: https://github.com/fredrikekre/Examples.jl/blob/master/ + Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/ ```@example inputfile - # Link to repo root: https://github.com/fredrikekre/Examples.jl/blob/master/ + # Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/ ``` - Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Examples.jl/blob/gh-pages/v1.2.0/ + Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/ ```@example inputfile - # Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Examples.jl/blob/gh-pages/v1.2.0/ + # Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/ ``` PLACEHOLDER1 @@ -312,16 +312,16 @@ end @test markdown == expected_markdown # no tag -> latest directory - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.markdown(inputfile, outdir) + Literate.markdown(inputfile, outdir) end markdown = read(joinpath(outdir, "inputfile.md"), String) - @test contains(markdown, "fredrikekre/Examples.jl/blob/gh-pages/latest/") + @test contains(markdown, "fredrikekre/Literate.jl/blob/gh-pages/latest/") # pre- and post-processing - Examples.markdown(inputfile, outdir, + Literate.markdown(inputfile, outdir, preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), postprocess = x -> replace(replace(x, "PLACEHOLDER2" => "2REDLOHECALP"), "PLACEHOLDER4" => "4REDLOHECALP")) markdown = read(joinpath(outdir, "inputfile.md"), String) @@ -335,7 +335,7 @@ end @test contains(markdown, "4REDLOHECALP") # documenter = false - Examples.markdown(inputfile, outdir, documenter = false) + Literate.markdown(inputfile, outdir, documenter = false) markdown = read(joinpath(outdir, "inputfile.md"), String) @test contains(markdown, "```julia") @test !contains(markdown, "```@example") @@ -343,14 +343,14 @@ end @test !contains(markdown, "EditURL") # codefence - Examples.markdown(inputfile, outdir, codefence = "```c" => "```") + Literate.markdown(inputfile, outdir, codefence = "```c" => "```") markdown = read(joinpath(outdir, "inputfile.md"), String) @test contains(markdown, "```c") @test !contains(markdown, "```@example") @test !contains(markdown, "```julia") # name - Examples.markdown(inputfile, outdir, name = "foobar") + Literate.markdown(inputfile, outdir, name = "foobar") markdown = read(joinpath(outdir, "foobar.md"), String) @test contains(markdown, "```@example foobar") @test !contains(markdown, "```@example inputfile") @@ -358,7 +358,7 @@ end end end -@testset "Examples.notebook" begin +@testset "Literate.notebook" begin mktempdir(@__DIR__) do sandbox cd(sandbox) do # write content to inputfile @@ -367,10 +367,10 @@ end outdir = mktempdir(pwd()) # test defaults - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "v1.2.0", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.notebook(inputfile, outdir, execute = false) + Literate.notebook(inputfile, outdir, execute = false) end expected_cells = rstrip.(( """ @@ -425,25 +425,25 @@ end """ "source": [ - "Link to repo root: https://github.com/fredrikekre/Examples.jl/blob/master/" + "Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/" ] """, """ "source": [ - "# Link to repo root: https://github.com/fredrikekre/Examples.jl/blob/master/" + "# Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/" ] """, """ "source": [ - "Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Examples.jl/blob/gh-pages/v1.2.0/" + "Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/" ] """, """ "source": [ - "# Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Examples.jl/blob/gh-pages/v1.2.0/" + "# Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/" ] """, @@ -487,13 +487,13 @@ end end # no tag -> latest directory - withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", + withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do - Examples.notebook(inputfile, outdir, execute = false) + Literate.notebook(inputfile, outdir, execute = false) end notebook = read(joinpath(outdir, "inputfile.ipynb"), String) - @test contains(notebook, "fredrikekre/Examples.jl/blob/gh-pages/latest/") + @test contains(notebook, "fredrikekre/Literate.jl/blob/gh-pages/latest/") # pre- and post-processing function post(nb) @@ -505,7 +505,7 @@ end end return nb end - Examples.notebook(inputfile, outdir, execute = false, + Literate.notebook(inputfile, outdir, execute = false, preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), postprocess = post) notebook = read(joinpath(outdir, "inputfile.ipynb"), String) @@ -519,13 +519,13 @@ end @test contains(notebook, "4REDLOHECALP") # documenter = false - Examples.notebook(inputfile, outdir, documenter = false, execute = false) + Literate.notebook(inputfile, outdir, documenter = false, execute = false) notebook = read(joinpath(outdir, "inputfile.ipynb"), String) @test contains(notebook, "# [Example](@id example-id") @test contains(notebook, "[foo](@ref), [bar](@ref bbaarr)") # name - Examples.notebook(inputfile, outdir, name = "foobar", execute = false) + Literate.notebook(inputfile, outdir, name = "foobar", execute = false) @test isfile(joinpath(outdir, "foobar.ipynb")) end end