2nd attempt to fix #37
should be fixed now
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index 5fb9adc..81f4249 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -59,8 +59,11 @@
kable_info$ncol <- nchar(kable_info$align)
# Caption
if (str_detect(kable_input, "caption\\[")) {
- kable_info$caption.short <- str_match(kable_input, "caption\\[(.*?)\\]")[2]
- kable_info$caption <- str_match(kable_input, "caption.*?\\{(.*?)\\n")[2]
+ caption_line <- str_match(kable_input, "\\\\caption(.*)\\n")[2]
+ kable_info$caption.short <- str_match(caption_line, "\\[(.*?)\\]")[2]
+ kable_info$caption <- substr(caption_line,
+ nchar(kable_info$caption.short) + 4,
+ nchar(caption_line) - 1)
} else {
kable_info$caption <- str_match(kable_input, "caption\\{(.*?)\\n")[2]
}