Merge pull request #209 from antaldaniel/master
Non-English text in kable_as_image
diff --git a/R/add_indent.R b/R/add_indent.R
index a8a455e..35cc196 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -48,7 +48,9 @@
for (i in positions + table_info$position_offset) {
rowtext <- table_info$contents[i]
- out <- sub(rowtext, latex_indent_unit(rowtext), out, perl = TRUE)
+ out <- sub(paste0(rowtext, "\\\\\\\\\n"),
+ paste0(latex_indent_unit(rowtext), "\\\\\\\\\n"),
+ out, perl = TRUE)
table_info$contents[i] <- latex_indent_unit(rowtext)
}
out <- structure(out, format = "latex", class = "knitr_kable")
diff --git a/R/group_rows.R b/R/group_rows.R
index f6f0d43..4ac5654 100644
--- a/R/group_rows.R
+++ b/R/group_rows.R
@@ -186,7 +186,9 @@
regex_escape(extra_latex_after, double_backslash = TRUE))
}
new_rowtext <- paste0(pre_rowtext, rowtext)
- out <- sub(rowtext, new_rowtext, out)
+ out <- sub(paste0(rowtext, "\\\\\\\\\n"),
+ paste0(new_rowtext, "\\\\\\\\\n"),
+ out)
out <- gsub("\\\\addlinespace\n", "", out)
out <- structure(out, format = "latex", class = "knitr_kable")
table_info$group_rows_used <- TRUE
diff --git a/R/kable_styling.R b/R/kable_styling.R
index 4bb7a97..4c2b5e7 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -507,7 +507,7 @@
# fontsize is good enough
return(paste0(
"\\begingroup\\fontsize{", font_size, "}{", row_height, "}\\selectfont\n", x,
- "\\endgroup{}"
+ "\n\\endgroup{}"
))
}
diff --git a/R/print.R b/R/print.R
index 7752d98..344d43d 100644
--- a/R/print.R
+++ b/R/print.R
@@ -10,7 +10,7 @@
if (interactive() & rstudioapi::isAvailable()) {
htmltools::html_print(html_result, viewer = rstudioapi::viewer)
}
- print(html_result)
+ # print(html_result)
}
#' HTML dependency for js script to enable bootstrap tooltip and popup message
diff --git a/README.md b/README.md
index ffba70f..2ac66c2 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
[![CRAN_version](http://www.r-pkg.org/badges/version/kableExtra)](https://cran.r-project.org/package=kableExtra)
[![CRAN_download](http://cranlogs.r-pkg.org/badges/kableExtra)](https://cran.r-project.org/package=kableExtra)
[![CRAN_download_total](http://cranlogs.r-pkg.org/badges/grand-total/kableExtra)](https://cran.r-project.org/package=kableExtra)
+[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1035917.svg)](https://doi.org/10.5281/zenodo.1035917)
+
***
diff --git a/docs/awesome_table_in_html.Rmd b/docs/awesome_table_in_html.Rmd
index 3af994c..8e9f38f 100644
--- a/docs/awesome_table_in_html.Rmd
+++ b/docs/awesome_table_in_html.Rmd
@@ -173,16 +173,17 @@
It is very easy to use `cell_spec` with conditional logic. Here is an example.
```{r, message=FALSE, warning=FALSE}
library(dplyr)
+options(knitr.table.format = "html")
mtcars[1:10, 1:2] %>%
mutate(
car = row.names(.),
- mpg = cell_spec(mpg, color = ifelse(mpg > 20, "red", "blue")),
- cyl = cell_spec(cyl, color = "white", align = "c", angle = 45,
+ mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
+ cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
background = factor(cyl, c(4, 6, 8),
c("#666666", "#999999", "#BBBBBB")))
) %>%
select(car, mpg, cyl) %>%
- kable(escape = F) %>%
+ kable(format = "html", escape = F) %>%
kable_styling("striped", full_width = F)
```
diff --git a/docs/awesome_table_in_html.html b/docs/awesome_table_in_html.html
index a2b79c7..67ba962 100644
--- a/docs/awesome_table_in_html.html
+++ b/docs/awesome_table_in_html.html
@@ -1962,16 +1962,17 @@
<h2>Conditional logic</h2>
<p>It is very easy to use <code>cell_spec</code> with conditional logic. Here is an example.</p>
<pre class="r"><code>library(dplyr)
+options(knitr.table.format = "html")
mtcars[1:10, 1:2] %>%
mutate(
car = row.names(.),
- mpg = cell_spec(mpg, color = ifelse(mpg > 20, "red", "blue")),
- cyl = cell_spec(cyl, color = "white", align = "c", angle = 45,
+ mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
+ cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
background = factor(cyl, c(4, 6, 8),
c("#666666", "#999999", "#BBBBBB")))
) %>%
select(car, mpg, cyl) %>%
- kable(escape = F) %>%
+ kable(format = "html", escape = F) %>%
kable_styling("striped", full_width = F)</code></pre>
<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
@@ -3548,7 +3549,7 @@
1
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3588,7 +3589,7 @@
6
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3596,7 +3597,7 @@
7
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3607,7 +3608,7 @@
8
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3615,7 +3616,7 @@
9
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3637,7 +3638,7 @@
11
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3645,7 +3646,7 @@
12
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3656,7 +3657,7 @@
13
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3664,7 +3665,7 @@
14
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3672,7 +3673,7 @@
15
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
</tbody>
diff --git a/docs/awesome_table_in_pdf.Rmd b/docs/awesome_table_in_pdf.Rmd
index 5be9621..ad14459 100644
--- a/docs/awesome_table_in_pdf.Rmd
+++ b/docs/awesome_table_in_pdf.Rmd
@@ -37,7 +37,7 @@
\end{wrapfigure}
The goal of `kableExtra` is to help you build common complex tables and manipulate table styles. It imports the pipe `%>%` symbol from `magrittr` and verbalizes all the functions, so basically you can add "layers" to a kable output in a way that is similar with `ggplot2` and `plotly`.
-To learn how to generate complex tables in LaTeX, please visit [http://haozhu233.github.io/kableExtra/awesome_table_in_html.html](http://haozhu233.github.io/kableExtra/awesome_table_in_html.html).
+To learn how to generate complex tables in HTML, please visit [http://haozhu233.github.io/kableExtra/awesome_table_in_html.html](http://haozhu233.github.io/kableExtra/awesome_table_in_html.html).
# Installation
```r
diff --git a/docs/awesome_table_in_pdf.pdf b/docs/awesome_table_in_pdf.pdf
index 90d7b15..8724c98 100644
--- a/docs/awesome_table_in_pdf.pdf
+++ b/docs/awesome_table_in_pdf.pdf
Binary files differ