Skip to content

Commit

Permalink
Filter out empty expressions in parseblock, fix #823.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Aug 29, 2018
1 parent a388bd1 commit 4598bbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions test/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4598bbf

Please sign in to comment.