Skip to content

Commit d520023

Browse files
committed
fix #1522: use the first <title> if there are multiple
1 parent a78de97 commit d520023

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bookdown
22
Type: Package
33
Title: Authoring Books and Technical Documents with R Markdown
4-
Version: 0.46.3
4+
Version: 0.46.4
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
77
person("Christophe", "Dervieux", , "cderv@posit.co", role = c("ctb"),

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# CHANGES IN bookdown VERSION 0.47
22

3+
- Fixed the bug that `prepend_chapter_title()` errors with "the condition has length > 1" when the page `<head>` contains more than one `<title>` tag (thanks, @samperman, #1522).
34

45
# CHANGES IN bookdown VERSION 0.46
56

R/html.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,7 @@ restore_math_labels = function(x) {
12261226
prepend_chapter_title = function(head, body) {
12271227
r1 = '(.*?<title>)(.+?)(</title>.*)'
12281228
if (length(i <- grep(r1, head)) == 0) return(head)
1229+
i = i[1]
12291230
body = paste(body, collapse = ' ')
12301231
r2 = '.*?<h[0-6][^>]*>(.+?)</h[0-6]>.*'
12311232
if (!grepl(r2, body)) return(head)

0 commit comments

Comments
 (0)