Skip to content

Commit

Permalink
Merge pull request JuliaLang#10081 from hayd/md_plain_table
Browse files Browse the repository at this point in the history
fix use io rather than STDOUT in markdown table
  • Loading branch information
ivarne committed Feb 5, 2015
2 parents 030e30c + f508cb3 commit 17ae66f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 8 additions & 8 deletions base/markdown/GitHub/table.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ function plain(io::IO, md::Table)
cells = mapmap(plaininline, md.rows)
padcells!(cells, md.align, len = length, min = 3)
for i = 1:length(cells)
print_joined(STDOUT, cells[i], " | ")
println()
print_joined(io, cells[i], " | ")
println(io)
if i == 1
print_joined(STDOUT, [_dash(length(cells[i][j]), md.align[j]) for j = 1:length(cells[1])], " | ")
println()
print_joined(io, [_dash(length(cells[i][j]), md.align[j]) for j = 1:length(cells[1])], " | ")
println(io)
end
end
end
Expand All @@ -117,11 +117,11 @@ function term(io::IO, md::Table, columns)
cells = mapmap(terminline, md.rows)
padcells!(cells, md.align, len = ansi_length)
for i = 1:length(cells)
print_joined(STDOUT, cells[i], " ")
println()
print_joined(io, cells[i], " ")
println(io)
if i == 1
print_joined(STDOUT, [""^ansi_length(cells[i][j]) for j = 1:length(cells[1])], " ")
println()
print_joined(io, [""^ansi_length(cells[i][j]) for j = 1:length(cells[1])], " ")
println(io)
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/markdown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ writemime(io::IO, m::MIME"text/plain", r::Reference) =
["hgh",Bold("jhj"),"ge"],
"f"]],
[:l, :r, :r]))
t = """a | b
:-- | --:
1 | 2
"""
@test plain(Markdown.parse(t)) == t

0 comments on commit 17ae66f

Please sign in to comment.