From 4598bbf1338e723f874524db583691b725d92e3f Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Thu, 30 Aug 2018 01:32:14 +0200 Subject: [PATCH] Filter out empty expressions in parseblock, fix #823. --- src/Utilities/Utilities.jl | 5 ++++- test/utilities.jl | 10 ++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Utilities/Utilities.jl b/src/Utilities/Utilities.jl index ad2dca41a7..d8b67e8e62 100644 --- a/src/Utilities/Utilities.jl +++ b/src/Utilities/Utilities.jl @@ -137,7 +137,10 @@ function parseblock(code::AbstractString, doc, page; skip = 0, keywords = true) break end end - push!(results, (ex, SubString(code, cursor, prevind(code, ncursor)))) + str = SubString(code, cursor, prevind(code, ncursor)) + if !isempty(strip(str)) + push!(results, (ex, str)) + end cursor = ncursor end results diff --git a/test/utilities.jl b/test/utilities.jl index db407a34a0..7e8e0ff869 100644 --- a/test/utilities.jl +++ b/test/utilities.jl @@ -178,16 +178,14 @@ end end end - @testset "issue #749, #790" begin + @testset "issues #749, #790, #823" begin let parse(x) = Documenter.Utilities.parseblock(x, nothing, nothing) for LE in ("\r\n", "\n") - l1, l2, l3 = parse("x = Int[]$(LE)$(LE)push!(x, 1)$(LE)") + l1, l2 = parse("x = Int[]$(LE)$(LE)push!(x, 1)$(LE)") @test l1[1] == :(x = Int[]) @test l1[2] == "x = Int[]$(LE)" - @test l2[1] == QuoteNode(Symbol("")) - @test l2[2] == "$(LE)" - @test l3[1] == :(push!(x, 1)) - @test l3[2] == "push!(x, 1)$(LE)" + @test l2[1] == :(push!(x, 1)) + @test l2[2] == "push!(x, 1)$(LE)" end end end