From 1f2e422c6a36970036c5d84f2f114c236d587f2a Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 12 Aug 2021 16:47:16 -0500 Subject: [PATCH] fix #605: allow non-alnum characters in .html filenames (#1231) also fix #902 and fix #1000 --- NEWS.md | 2 ++ R/html.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 654fe9b5a..e619dca57 100644 --- a/NEWS.md +++ b/NEWS.md @@ -52,6 +52,8 @@ ## BUG FIXES +- Removed the requirement for `.html` filenames to be alphanumeric, which fixes a common error "Automatically generated filenames contain duplicated ones: -" (thanks, @psychelzh #605, @AzureRabbit #902, @carloslederman #1000, Ritsu Kitagawa https://stackoverflow.com/q/60014350/559676, Shrek Tan). + - Fix an issue with `bookdown_site()` where the comment in `site:` line key was not supported (thanks, @LDSamson, #1194). - Figure reference links now point correctly to the top of figures (thanks, @GuillaumeBiessy, #1155). diff --git a/R/html.R b/R/html.R index 6ea35a642..e4d22decf 100644 --- a/R/html.R +++ b/R/html.R @@ -395,7 +395,7 @@ split_chapters = function( paste(c(num, id), collapse = '-') } else id if (is.null(nm)) stop('The heading ', x2, ' must have an id') - gsub('[^[:alnum:]]+', '-', nm) + nm }) if (anyDuplicated(nms)) (if (isTRUE(opts$get('preview'))) warning else stop)( 'Automatically generated filenames contain duplicated ones: ',