Skip to content

Commit

Permalink
Add force_unknown_rows parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed May 31, 2018
1 parent a014bae commit d9cfd43
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/TableShowUtils.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
module TableShowUtils

function printtable(io::IO, source, typename::AbstractString)
function printtable(io::IO, source, typename::AbstractString; force_unknown_rows=false)
T = eltype(source)

if Base.iteratorsize(source)==Base.HasLength()
if force_unknown_rows
rows = nothing
data = Iterators.take(source, 10) |> collect
elseif Base.iteratorsize(source)==Base.HasLength()
rows = length(source)
data = Iterators.take(source, 10) |> collect
else
Expand Down Expand Up @@ -110,12 +113,14 @@ function printtable(io::IO, source, typename::AbstractString)
end
end

function printHTMLtable(io, source)
function printHTMLtable(io, source; force_unknown_rows=false)
colnames = String.(fieldnames(eltype(source)))

max_elements = 10

if Base.iteratorsize(source)==Base.HasLength()
if force_unknown_rows
rows = nothing
elseif Base.iteratorsize(source)==Base.HasLength()
rows = length(source)
else
count_needed_plus_one = Iterators.count(i->true, Iterators.take(source, max_elements+1))
Expand Down

0 comments on commit d9cfd43

Please sign in to comment.