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/add_indent.R b/R/add_indent.R
index 35cc196..44ea7cd 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -48,8 +48,8 @@
for (i in positions + table_info$position_offset) {
rowtext <- table_info$contents[i]
- out <- sub(paste0(rowtext, "\\\\\\\\\n"),
- paste0(latex_indent_unit(rowtext), "\\\\\\\\\n"),
+ out <- sub(paste0(rowtext, "(\\\\\\\\\\*?(\\[.*\\])?\n)"),
+ paste0(latex_indent_unit(rowtext), "\\1"),
out, perl = TRUE)
table_info$contents[i] <- latex_indent_unit(rowtext)
}