simplied some logics;
Added position offset to row_spec;
Adding @leovan to author list
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index 927aaec..5c2a942 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -90,14 +90,12 @@
}
kable_info$duplicated_rows <- (sum(duplicated(kable_info$contents)) != 0)
# Column names
- if (kable_info$booktabs) {
- if (is.na(which(read_lines(kable_input) == "\\midrule")[1])) {
- kable_info$colnames <- NULL
- } else {
- kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
- }
+ if (kable_info$booktabs & !grepl("\\\\midrule", kable_input)) {
+ kable_info$colnames <- NULL
+ kable_info$position_offset <- 0
} else {
kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
+ kable_info$position_offset <- 1
}
# Row names
kable_info$rownames <- str_extract(kable_info$contents, "^[^ &]*")