From 9904ac09d00dc316ffc5a3274fc5e16e08eff6df Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:54:31 +0900 Subject: [PATCH 1/3] fix: error in 1:max_n from bs4_book() --- R/bs4_book.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/bs4_book.R b/R/bs4_book.R index 9f9b13403..8b1170bfe 100644 --- a/R/bs4_book.R +++ b/R/bs4_book.R @@ -596,7 +596,7 @@ tweak_metadata <- function(html, path) { if (nzchar(text)) { words <- unlist(strsplit(text, " ")) no_char <- cumsum(unlist(lapply(words, function(x) {nchar(x) + 1}))) - max_n <- max(which(no_char<= 197)) + max_n <- max(which(no_char <= 197), 1) description_string <- paste(words[1: max_n], collapse = " ") if (max_n != length(words)) { description_string <- paste0(description_string, "...") From c52b6c4b74125c546c7102292dcaf00dd98a43c8 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:04:24 +0900 Subject: [PATCH 2/3] doc(NEWS): fixed error on generating description from a long sentence --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 4e611c79b..247c6a162 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # CHANGES IN bookdown VERSION 0.39 - +- Fixed a bug that `bs4_book()` errors on generating document description. The error occured when the beggining of the document is a very long sentence without spaces (> 197 characters), which typically happens in CJK languages (thanks, @atusy, #1463). # CHANGES IN bookdown VERSION 0.38 From 87f8f6103ff3cb0311b9fe6dbad82f23ef7a5211 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Wed, 3 Apr 2024 11:20:30 +0200 Subject: [PATCH 3/3] Bump dev version [skip ci] --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 87b806442..083f6b5a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: bookdown Type: Package Title: Authoring Books and Technical Documents with R Markdown -Version: 0.38.1 +Version: 0.38.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Christophe", "Dervieux", , "cderv@posit.co", role = c("ctb"),