Skip to content

Commit 322b043

Browse files
authored
Merge pull request #23 from davidanthoff/tableshowutils
Use TableShowUtils.jl
2 parents ba090be + 0d2920f commit 322b043

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ DataValues 0.1.0
77
FileIO 0.9.0
88
HTTP 0.6.0
99
IterableTables 0.6.1
10+
TableShowUtils 0.0.1

src/CSVFiles.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module CSVFiles
22

33
using TextParse, IteratorInterfaceExtensions, TableTraits, TableTraitsUtils,
4-
DataValues, FileIO, HTTP
4+
DataValues, FileIO, HTTP, TableShowUtils
55
import IterableTables
66

77
export load, save
@@ -18,6 +18,26 @@ struct CSVStream
1818
keywords
1919
end
2020

21+
function Base.show(io::IO, source::CSVFile)
22+
TableShowUtils.printtable(io, getiterator(source), "CSV file")
23+
end
24+
25+
function Base.show(io::IO, ::MIME"text/html", source::CSVFile)
26+
TableShowUtils.printHTMLtable(io, getiterator(source))
27+
end
28+
29+
Base.Multimedia.mimewritable(::MIME"text/html", source::CSVFile) = true
30+
31+
function Base.show(io::IO, source::CSVStream)
32+
TableShowUtils.printtable(io, getiterator(source), "CSV file")
33+
end
34+
35+
function Base.show(io::IO, ::MIME"text/html", source::CSVStream)
36+
TableShowUtils.printHTMLtable(io, getiterator(source))
37+
end
38+
39+
Base.Multimedia.mimewritable(::MIME"text/html", source::CSVStream) = true
40+
2141
function fileio_load(f::FileIO.File{FileIO.format"CSV"}, delim=','; args...)
2242
return CSVFile(f.filename, delim, args)
2343
end

0 commit comments

Comments
 (0)