From b824e45609f326f8ac412a537c3d3da0d0319f7d Mon Sep 17 00:00:00 2001 From: "Mathew W. McLean" Date: Wed, 25 Sep 2024 12:26:32 +1000 Subject: [PATCH] Fix 7073a if names require braces * See toBibtex.person, braces seem necessary if no family name is detected * Addresses #106 --- R/toBiblatex.R | 2 +- tests/testthat/test-tobiblatex.R | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/R/toBiblatex.R b/R/toBiblatex.R index 49eb068..4cd632c 100644 --- a/R/toBiblatex.R +++ b/R/toBiblatex.R @@ -91,7 +91,7 @@ EncodedNameListToLaTeX <- function(name.list, encoding = "UTF-8") { formatted.text <- format_author(name.list) out <- encoded_text_to_latex(formatted.text, encoding) - if (grepl("^[?]", out)) + if (grepl("^[{]?[?]", out)) return(formatted.text) return(out) } diff --git a/tests/testthat/test-tobiblatex.R b/tests/testthat/test-tobiblatex.R index e14b686..ce9955b 100644 --- a/tests/testthat/test-tobiblatex.R +++ b/tests/testthat/test-tobiblatex.R @@ -1,12 +1,21 @@ -bib = BibEntry(bibtype = "article", - key = "shiotsuki2011kasai", - title = "葛西賢太著,『現代瞑想論-変性意識がひらく世界-』", - author = "塩,亮子 and 葛西,賢太", - journal = "宗教と社会", - volume = 17, - pages = "67--69", - year = 2011, - publisher = "「宗教と社会」学会") +bib <- c(BibEntry(bibtype = "article", + key = "shiotsuki2011kasai", + title = "葛西賢太著,『現代瞑想論-変性意識がひらく世界-』", + author = "塩,亮子 and 葛西,賢太", + journal = "宗教と社会", + volume = 17, + pages = "67--69", + year = 2011, + publisher = "「宗教と社会」学会"), + BibEntry(bibtype = "article", + key = "hiromitsu2022altered", + title = "意識状態の変容と脳内ネットワーク", + author = "弘光健太郎 and ヒロミツケンタロウ", + journal = "鶴見大学仏教文化研究所紀要", + volume = 27, + pages = "53--66", + year = 2022, + publisher = "鶴見大学")) test_that("toBiblatex doesn't replace CJK character name lists with ???? (#106)", {