From fcfcf0fd28a670b24f8168a5eea6d10d6e6fdaef Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 23 Jan 2019 15:27:28 +0100 Subject: [PATCH] fix #886: skip keyword special casing in code-block parsing. --- CHANGELOG.md | 6 ++++++ src/Expanders.jl | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee566c92841..bbfd5bfd590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ * ![Bugfix][badge-bugfix] `@repl` blocks now work correctly together with quoted expressions. ([#923][github-923], [#926][github-926]) +* ![Bugfix][badge-bugfix] `@example`, `@repl` and `@eval` blocks now handle keywords, + e.g. `try`/`catch`, correctly. ([#886][github-886], [#927][github-927]) + ## Version `v0.21.0` * ![Deprecation][badge-deprecation] ![Enhancement][badge-enhancement] The symbol values to the `format` argument of `makedocs` (`:html`, `:markdown`, `:latex`) have been deprecated in favor of the `Documenter.HTML`, `Markdown` and `LaTeX` @@ -176,12 +179,15 @@ [github-876]: https://github.com/JuliaDocs/Documenter.jl/pull/876 [github-879]: https://github.com/JuliaDocs/Documenter.jl/pull/879 [github-885]: https://github.com/JuliaDocs/Documenter.jl/pull/885 +[github-886]: https://github.com/JuliaDocs/Documenter.jl/pull/886 [github-891]: https://github.com/JuliaDocs/Documenter.jl/pull/891 [github-898]: https://github.com/JuliaDocs/Documenter.jl/pull/898 [github-905]: https://github.com/JuliaDocs/Documenter.jl/pull/905 [github-907]: https://github.com/JuliaDocs/Documenter.jl/pull/907 +[github-917]: https://github.com/JuliaDocs/Documenter.jl/pull/917 [github-923]: https://github.com/JuliaDocs/Documenter.jl/pull/923 [github-926]: https://github.com/JuliaDocs/Documenter.jl/pull/926 +[github-927]: https://github.com/JuliaDocs/Documenter.jl/pull/927 [documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl [documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl diff --git a/src/Expanders.jl b/src/Expanders.jl index b26ffaf426f..e10714b7232 100644 --- a/src/Expanders.jl +++ b/src/Expanders.jl @@ -432,7 +432,7 @@ function Selectors.runner(::Type{EvalBlocks}, x, page, doc) sandbox = Module(:EvalBlockSandbox) cd(dirname(page.build)) do result = nothing - for (ex, str) in Utilities.parseblock(x.code, doc, page) + for (ex, str) in Utilities.parseblock(x.code, doc, page; keywords = false) try result = Core.eval(sandbox, ex) catch err @@ -484,7 +484,7 @@ function Selectors.runner(::Type{ExampleBlocks}, x, page, doc) else code = x.code end - for (ex, str) in Utilities.parseblock(code, doc, page) + for (ex, str) in Utilities.parseblock(code, doc, page; keywords = false) (value, success, backtrace, text) = Utilities.withoutput() do cd(dirname(page.build)) do Core.eval(mod, Expr(:(=), :ans, ex)) @@ -542,7 +542,7 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc) mod = get!(() -> get_new_sandbox(sym), page.globals.meta, sym) code = split(x.code, '\n'; limit = 2)[end] result, out = nothing, IOBuffer() - for (ex, str) in Utilities.parseblock(x.code, doc, page) + for (ex, str) in Utilities.parseblock(x.code, doc, page; keywords = false) buffer = IOBuffer() input = droplines(str) (value, success, backtrace, text) = Utilities.withoutput() do