Merge pull request #202 from tshort/hook-fix

Fix hooks and add a push/pop hook to the test
pull/224/head
Sebastian Pfitzner 2019-06-25 18:10:38 +02:00 committed by GitHub
commit 9f664ba5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -226,11 +226,11 @@ include_weave(source, informat=:auto) = include_weave(Main, source, informat)
#but note that Weave hooks take the chunk as input
const preexecute_hooks = Function[]
push_preexecute_hook(f::Function) = push!(preexecute_hooks, f)
pop_preexecute_hook(f::Function) = splice!(preexecute_hooks, findfirst(preexecute_hooks, f))
pop_preexecute_hook(f::Function) = splice!(preexecute_hooks, findfirst(x -> x == f, preexecute_hooks))
const postexecute_hooks = Function[]
push_postexecute_hook(f::Function) = push!(postexecute_hooks, f)
pop_postexecute_hook(f::Function) = splice!(postexecute_hooks, findfirst(postexecute_hooks, f))
pop_postexecute_hook(f::Function) = splice!(postexecute_hooks, findfirst(x -> x == f, postexecute_hooks))
include("chunks.jl")
include("config.jl")

View File

@ -5,7 +5,9 @@ cleanup = true
VER = "$(VERSION.major).$(VERSION.minor)"
Weave.push_preexecute_hook(identity)
weave("documents/chunk_options.noweb")
Weave.pop_preexecute_hook(identity)
result = read("documents/chunk_options.md", String)
ref = read("documents/chunk_options_ref.md", String)
@test result == ref