Skip to content

Commit

Permalink
Fix at-repl blocks
Browse files Browse the repository at this point in the history
The STDOUT from the executed code should be printed after the prompt
line. And we should also apply the appropriate julia-repl language to
the output blocks.
  • Loading branch information
mortenpi committed May 14, 2017
1 parent a4506e8 commit 6445adc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Expanders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -504,21 +504,21 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc)
end
end
result = value
print(out, text)
local output = if success
hide = Documenter.DocChecks.ends_with_semicolon(input)
Documenter.DocChecks.result_to_string(buffer, hide ? nothing : value)
else
Documenter.DocChecks.error_to_string(buffer, value, [])
end
isempty(input) || println(out, prepend_prompt(input))
print(out, text)
if isempty(input) || isempty(output)
println(out)
else
println(out, output, "\n")
end
end
page.mapping[x] = Base.Markdown.Code("julia", rstrip(Utilities.takebuf_str(out)))
page.mapping[x] = Base.Markdown.Code("julia-repl", rstrip(Utilities.takebuf_str(out)))
end

# @setup
Expand Down
7 changes: 7 additions & 0 deletions test/examples/src/man/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ f(0.01)
div(1, 0)
```

Make sure that STDOUT is in the right place (#484):

```@repl 1
println("---") === nothing
versioninfo()
```

```@eval
1 + 2
nothing
Expand Down

0 comments on commit 6445adc

Please sign in to comment.