Skip to content

Commit

Permalink
fix use of REPL and ip_matches_func (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet authored and mortenpi committed Jan 23, 2018
1 parent 3e99384 commit f3d7d19
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Provides two functions, [`missingdocs`](@ref) and [`doctest`](@ref), for checkin
module DocChecks

import ..Documenter:
Documenter,
Builder,
Documents,
Expanders,
Expand Down Expand Up @@ -184,7 +185,7 @@ function eval_repl(code, sandbox, meta::Dict, doc::Documents.Document, page)
result = Result(code, input, output, meta[:CurrentFile])
for (ex, str) in Utilities.parseblock(input, doc, page; keywords = false)
# Input containing a semi-colon gets suppressed in the final output.
result.hide = Base.REPL.ends_with_semicolon(str)
result.hide = Documenter.REPL.ends_with_semicolon(str)
(value, success, backtrace, text) = Utilities.withoutput() do
disable_color() do
Core.eval(sandbox, ex)
Expand Down Expand Up @@ -286,7 +287,7 @@ funcsym() = CAN_INLINE[] ? :disable_color : :eval
function error_to_string(buf, er, bt)
fs = funcsym()
# Remove unimportant backtrace info.
index = findlast(ptr -> Base.REPL.ip_matches_func(ptr, fs), bt)
index = findlast(ptr -> Documenter.ip_matches_func(ptr, fs), bt)
# Print a REPL-like error message.
disable_color() do
print(buf, "ERROR: ")
Expand Down
8 changes: 8 additions & 0 deletions src/Documenter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ else
const IdDict = Base.IdDict{Any,Any}
end

@static if VERSION < v"0.7.0-DEV.3500"
import Base.REPL
using Base.REPL: ip_matches_func
else
import REPL
using Base: ip_matches_func
end

# Submodules
# ----------

Expand Down
2 changes: 1 addition & 1 deletion src/Expanders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc)
end
result = value
output = if success
hide = Base.REPL.ends_with_semicolon(input)
hide = Documenter.REPL.ends_with_semicolon(input)
Documenter.DocChecks.result_to_string(buffer, hide ? nothing : value)
else
Documenter.DocChecks.error_to_string(buffer, value, [])
Expand Down

0 comments on commit f3d7d19

Please sign in to comment.