From 9ccf8f1367e57c7a1bec5e9b16d9332f548417c7 Mon Sep 17 00:00:00 2001 From: Chun-Hui Gao Date: Thu, 17 Oct 2024 12:00:20 +0800 Subject: [PATCH] Update R/utils.R Co-authored-by: Yihui Xie --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 2ec19acbee..b31ec83a65 100644 --- a/R/utils.R +++ b/R/utils.R @@ -511,7 +511,7 @@ pandoc_fragment = function(text, to = pandoc_to(), from = pandoc_from()) { #' @examples fig_path('.pdf', options = list(fig.path='figure/abc-', label='first-plot')) #' fig_path('.png', list(fig.path='foo-', label='bar'), 1:10) fig_path = function(suffix = '', options = opts_current$get(), number) { - if (all(suffix != '') && all(!grepl('[.]', suffix))) suffix = paste0('.', suffix) + suffix = sub('^([^.])', '.\\1', suffix) if (missing(number)) number = options$fig.cur %n% 1L if (!is.null(number)) suffix = paste0('-', number, suffix) path = valid_path(options$fig.path, options$label)