Skip to content

Commit

Permalink
writemime -> show and deal with nullable cells
Browse files Browse the repository at this point in the history
  • Loading branch information
maximerischard committed Sep 28, 2016
1 parent 36fd382 commit 15ddd85
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/abstractdataframe/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function latex_escape(cell::AbstractString)
return cell
end

function Base.writemime(io::IO,
function Base.show(io::IO,
::MIME"text/latex",
df::AbstractDataFrame)
nrows = size(df, 1)
Expand All @@ -242,10 +242,13 @@ function Base.writemime(io::IO,
for col in 1:ncols
write(io, " & ")
cell = df[row,col]
if mimewritable(MIME("text/latex"), cell)
writemime(io, MIME("text/latex"), cell)
else
write(io, latex_escape(string(cell)))
if !isnull(cell)
content = get(cell)
if mimewritable(MIME("text/latex"), content)
Base.show(io, MIME("text/latex"), content)
else
Base.print(io, latex_escape(string(content)))
end
end
end
write(io, " \\\\ \n")
Expand Down

0 comments on commit 15ddd85

Please sign in to comment.