Skip to content

Commit

Permalink
Use consistent HTML class for stdout/err in example (#1360)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored Jul 14, 2020
1 parent 92fb49b commit 676a8f0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* ![Enhancement][badge-enhancement] When automatically determining the page list (i.e. `pages` is not passed to `makedocs`), Documenter now lists `index.md` before other pages. ([#1355][github-1355])

* ![Enhancement][badge-enhancement] The output text boxes of `@example` blocks are now style differently from the code blocks, to make it easier to visually distinguish between the input and output. ([#1026][github-1026], [#1357][github-1357])
* ![Enhancement][badge-enhancement] The output text boxes of `@example` blocks are now style differently from the code blocks, to make it easier to visually distinguish between the input and output. ([#1026][github-1026], [#1357][github-1357], [#1360][github-1360])

## Version `v0.25.0`

Expand Down Expand Up @@ -597,6 +597,7 @@
[github-1345]: https://github.com/JuliaDocs/Documenter.jl/pull/1345
[github-1355]: https://github.com/JuliaDocs/Documenter.jl/pull/1355
[github-1357]: https://github.com/JuliaDocs/Documenter.jl/pull/1357
[github-1360]: https://github.com/JuliaDocs/Documenter.jl/pull/1360

[documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl
[documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl
Expand Down
2 changes: 1 addition & 1 deletion src/Expanders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ function Selectors.runner(::Type{ExampleBlocks}, x, page, doc)
isempty(input) || push!(content, Markdown.Code("julia", input))
if result === nothing
code = Documenter.DocTests.sanitise(buffer)
isempty(code) || push!(content, Markdown.Code(code))
isempty(code) || push!(content, Dict{MIME,Any}(MIME"text/plain"() => code))
elseif !isempty(output)
push!(content, output)
end
Expand Down
3 changes: 3 additions & 0 deletions test/examples/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ htmlbuild_pages = Any[
],
"unicode.md",
"latex.md",
"example-output.md",
]

# Build with pretty URLs and canonical links and a PNG logo
Expand Down Expand Up @@ -275,6 +276,7 @@ examples_latex_doc = if "latex" in EXAMPLE_BUILDS
"latex.md",
"unicode.md",
hide("hidden.md"),
"example-output.md",
],
# SVG images nor code blocks in footnotes are allowed in LaTeX
# "Manual" => [
Expand Down Expand Up @@ -335,6 +337,7 @@ examples_latex_texonly_doc = if "latex_texonly" in EXAMPLE_BUILDS
"latex.md",
"unicode.md",
hide("hidden.md"),
"example-output.md",
],
# SVG images nor code blocks in footnotes are allowed in LaTeX
# "Manual" => [
Expand Down
11 changes: 11 additions & 0 deletions test/examples/src/example-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Example stdout

Checking that `@example` output is contained in a specific HTML class.

!!! warning

This file should contain exactly one `@example` for the test to work.

```@example
println("hello")
```
5 changes: 4 additions & 1 deletion test/examples/tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ end
index_html = read(joinpath(build_dir, "index.html"), String)
@test occursin("documenter-example-output", index_html)

example_output_html = read(joinpath(build_dir, "example-output", "index.html"), String)
@test occursin("documenter-example-output", example_output_html)

# Assets
@test joinpath(build_dir, "assets", "documenter.js") |> isfile

Expand Down Expand Up @@ -110,7 +113,7 @@ end

@test realpath(doc.internal.assets) == realpath(joinpath(dirname(@__FILE__), "..", "..", "assets"))

@test length(doc.blueprint.pages) == 18
@test length(doc.blueprint.pages) == 19

let headers = doc.internal.headers
@test Documenter.Anchors.exists(headers, "Documentation")
Expand Down

0 comments on commit 676a8f0

Please sign in to comment.