fix #303
Ensures that when duplicated rows are detected the correct line is replaced by sub.
Add's the same regex pattern to add_indent _latex for detecting lines that end in \\, \\*, \\[...] and \\*[...].
diff --git a/R/util.R b/R/util.R
index 6e174d7..efe13bc 100644
--- a/R/util.R
+++ b/R/util.R
@@ -129,7 +129,11 @@
new_row <- str_replace(
dup_row, "(?<=\\s)([\\S]+[\\s]*)$",
paste0("\\\\\\\\vphantom\\\\{", empty_times, "\\\\} \\1"))
- kable_input <- sub(dup_row, new_row, kable_input)
+ kable_input <- sub(
+ paste0(dup_row, "(?=\\s*\\\\\\\\\\*?(\\[.*\\])?)"),
+ new_row,
+ kable_input,
+ perl = TRUE)
table_info$contents[i] <- new_row
}
table_info$duplicated_rows <- FALSE