From 9e761d435407c1d6cd477f45a5d0510cb30c8ac6 Mon Sep 17 00:00:00 2001 From: Duncan Hobbs Date: Sun, 24 Mar 2019 10:23:02 -0400 Subject: [PATCH 1/5] add double line as default border --- src/Printing.jl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Printing.jl b/src/Printing.jl index 667765e..c87ee66 100644 --- a/src/Printing.jl +++ b/src/Printing.jl @@ -35,9 +35,10 @@ end star::Bool = true sep::String = default_sep(table_type) align::String = "c" - TableParams(pad, table_type, se_pos, star, sep, align) = begin + border::Symbol = :double + TableParams(pad, table_type, se_pos, star, sep, align, border) = begin # Argument Checking - return new(pad, table_type, se_pos, star, sep, align) + return new(pad, table_type, se_pos, star, sep, align, border) end end @@ -399,7 +400,12 @@ function top_matter(printer::TablePrinter{N,M}) where {N,M} align *= "c"^pair.second end - return "\\begin{tabular}{$align}\n\\toprule\n" + if border == :double + return "\\begin{tabular}{$align}\n\\hline\hline\n" + elseif border == :single + return "\\begin{tabular}{$align}\n\\toprule\n" + elseif border == :none + return "\\begin{tabular}{$align}\n\\hline\hline\n" end end @@ -657,11 +663,16 @@ end ######################################################################## #################### Footer ############################################ ######################################################################## - +# Footer edited to produce double horizontal function foot(t::TablePrinter) @unpack table_type = t.params table_type == :ascii && return "" - table_type == :latex && return "\\bottomrule\n\\end{tabular}" + if border == :double + table_type == :latex && return "\\hline\hline\n\\end{tabular}" + elseif border == :single + table_type == :latex && return "\\bottomrule\n\\end{tabular}" + elseif border == :none + table_type == :latex && return "\\hline\hline\n\\end{tabular}" end From b391f271476ef7537b9d711c3a49b0b1b5eb1cfa Mon Sep 17 00:00:00 2001 From: Duncan Hobbs Date: Sun, 24 Mar 2019 14:26:19 -0400 Subject: [PATCH 2/5] change defualt border to single. Add warning. --- src/Printing.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Printing.jl b/src/Printing.jl index c87ee66..dd12656 100644 --- a/src/Printing.jl +++ b/src/Printing.jl @@ -401,11 +401,11 @@ function top_matter(printer::TablePrinter{N,M}) where {N,M} end if border == :double - return "\\begin{tabular}{$align}\n\\hline\hline\n" + return "\\begin{tabular}{$align}\n\\hline\\hline\n" elseif border == :single return "\\begin{tabular}{$align}\n\\toprule\n" elseif border == :none - return "\\begin{tabular}{$align}\n\\hline\hline\n" + return "\\begin{tabular}{$align}\n\\hline\\hline\n" end end @@ -668,11 +668,11 @@ function foot(t::TablePrinter) @unpack table_type = t.params table_type == :ascii && return "" if border == :double - table_type == :latex && return "\\hline\hline\n\\end{tabular}" + table_type == :latex && return "\\hline\\hline\n\\end{tabular}" elseif border == :single table_type == :latex && return "\\bottomrule\n\\end{tabular}" elseif border == :none - table_type == :latex && return "\\hline\hline\n\\end{tabular}" + table_type == :latex && return "\\hline\\hline\n\\end{tabular}" end From 94547a0c723b1f6d913e632f6be3536da74e6489 Mon Sep 17 00:00:00 2001 From: Duncan Hobbs Date: Sun, 24 Mar 2019 14:27:16 -0400 Subject: [PATCH 3/5] add warning message that default will change in future. --- src/Printing.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Printing.jl b/src/Printing.jl index dd12656..7e59153 100644 --- a/src/Printing.jl +++ b/src/Printing.jl @@ -405,7 +405,8 @@ function top_matter(printer::TablePrinter{N,M}) where {N,M} elseif border == :single return "\\begin{tabular}{$align}\n\\toprule\n" elseif border == :none - return "\\begin{tabular}{$align}\n\\hline\\hline\n" + return "\\begin{tabular}{$align}\n\\toprule\n" + @warn("default border will change to double in future releases") end end @@ -672,7 +673,8 @@ function foot(t::TablePrinter) elseif border == :single table_type == :latex && return "\\bottomrule\n\\end{tabular}" elseif border == :none - table_type == :latex && return "\\hline\\hline\n\\end{tabular}" + table_type == :latex && return "\\bottomrule\n\\end{tabular}" + @warn("default border will change to double in future releases") end From 93b48b320ff0bc5283dab1d15548e7f11ee38d81 Mon Sep 17 00:00:00 2001 From: Duncan Hobbs Date: Mon, 25 Mar 2019 20:21:25 -0400 Subject: [PATCH 4/5] fix error in foot(TablePrinter) function. --- src/Printing.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Printing.jl b/src/Printing.jl index 7e59153..b00672b 100644 --- a/src/Printing.jl +++ b/src/Printing.jl @@ -675,6 +675,7 @@ function foot(t::TablePrinter) elseif border == :none table_type == :latex && return "\\bottomrule\n\\end{tabular}" @warn("default border will change to double in future releases") + end end From 687ac258c6be640740f488c3691a9f57369fcb35 Mon Sep 17 00:00:00 2001 From: Duncan Hobbs Date: Mon, 25 Mar 2019 21:10:10 -0400 Subject: [PATCH 5/5] fix more function end errors. --- src/Printing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Printing.jl b/src/Printing.jl index b00672b..affd96d 100644 --- a/src/Printing.jl +++ b/src/Printing.jl @@ -394,7 +394,7 @@ function top_matter(printer::TablePrinter{N,M}) where {N,M} for i=1:N align *= empty_row(t, i) ? "" : "r" end - +end for (i, pair) in enumerate(col_schema[max(M-1,1)]) align *= (M > 1) | (i==1) ? "|" : "" align *= "c"^pair.second