Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ DataValues 0.1.0
FileIO 0.9.0
HTTP 0.6.0
IterableTables 0.6.1
TableShowUtils 0.0.1
22 changes: 21 additions & 1 deletion src/CSVFiles.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module CSVFiles

using TextParse, IteratorInterfaceExtensions, TableTraits, TableTraitsUtils,
DataValues, FileIO, HTTP
DataValues, FileIO, HTTP, TableShowUtils
import IterableTables

export load, save
Expand All @@ -18,6 +18,26 @@ struct CSVStream
keywords
end

function Base.show(io::IO, source::CSVFile)
TableShowUtils.printtable(io, getiterator(source), "CSV file")
end

function Base.show(io::IO, ::MIME"text/html", source::CSVFile)
TableShowUtils.printHTMLtable(io, getiterator(source))
end

Base.Multimedia.mimewritable(::MIME"text/html", source::CSVFile) = true

function Base.show(io::IO, source::CSVStream)
TableShowUtils.printtable(io, getiterator(source), "CSV file")
end

function Base.show(io::IO, ::MIME"text/html", source::CSVStream)
TableShowUtils.printHTMLtable(io, getiterator(source))
end

Base.Multimedia.mimewritable(::MIME"text/html", source::CSVStream) = true

function fileio_load(f::FileIO.File{FileIO.format"CSV"}, delim=','; args...)
return CSVFile(f.filename, delim, args)
end
Expand Down