ropensci / bib2df

Parse a BibTeX file to a tibble
https://docs.ropensci.org/bib2df
99 stars 22 forks source link

bib2df_gather strips braces incorrectly #37

Open johnbaums opened 5 years ago

johnbaums commented 5 years ago

Some regex bugs exist in bib2df_gather, e.g.:

cat('@Article{mykey,
  Author = {me},
  Title = {{FOO} bar {bAZ}},
  Year = {2011}
}
', file=f <- tempfile())

bib <- bib2df::bib2df(f)
bib$TITLE
#> [1] "FOO} bar {bAZ"

Created on 2019-11-13 by the reprex package (v0.3.0.9000)

Session info ``` r sessioninfo::session_info() #> ─ Session info ────────────────────────────────────────────────────────── #> setting value #> version R version 3.6.0 (2019-04-26) #> os macOS Mojave 10.14.3 #> system x86_64, darwin15.6.0 #> ui X11 #> language (EN) #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Melbourne #> date 2019-11-13 #> #> ─ Packages ────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.0) #> bib2df 1.1.1 2019-11-13 [1] Github (ROpenSci/bib2df@e151772) #> cli 1.1.0 2019-03-19 [2] CRAN (R 3.6.0) #> crayon 1.3.4 2017-09-16 [2] CRAN (R 3.6.0) #> digest 0.6.22 2019-10-21 [1] CRAN (R 3.6.0) #> dplyr 0.8.3 2019-07-04 [2] CRAN (R 3.6.0) #> evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.0) #> glue 1.3.1 2019-03-12 [2] CRAN (R 3.6.0) #> highr 0.8 2019-03-20 [2] CRAN (R 3.6.0) #> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.0) #> httr 1.4.1 2019-08-05 [2] CRAN (R 3.6.0) #> humaniformat 0.6.0 2016-04-24 [1] CRAN (R 3.6.0) #> knitr 1.25 2019-09-18 [1] CRAN (R 3.6.0) #> magrittr 1.5 2014-11-22 [2] CRAN (R 3.6.0) #> pillar 1.4.2 2019-06-29 [2] CRAN (R 3.6.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0) #> purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.0) #> R6 2.4.0 2019-02-14 [2] CRAN (R 3.6.0) #> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.0) #> rlang 0.4.1 2019-10-24 [1] CRAN (R 3.6.0) #> rmarkdown 1.16 2019-10-01 [1] CRAN (R 3.6.0) #> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.6.0) #> stringi 1.4.3 2019-03-12 [2] CRAN (R 3.6.0) #> stringr 1.4.0 2019-02-10 [2] CRAN (R 3.6.0) #> tibble 2.1.3 2019-06-06 [2] CRAN (R 3.6.0) #> tidyselect 0.2.5 2018-10-11 [2] CRAN (R 3.6.0) #> withr 2.1.2 2018-03-15 [2] CRAN (R 3.6.0) #> xfun 0.10 2019-10-01 [1] CRAN (R 3.6.0) #> yaml 2.2.0 2018-07-25 [2] CRAN (R 3.6.0) #> #> [1] /Users/jbau/Library/R/3.6/library #> [2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library ```
johnbaums commented 5 years ago

Ah, looks like this was fixed as per #29, but not merged into master.

ottlngr commented 4 years ago

Hi,

sorry for the delay. I made adjustments in the code and added a testcase covering this issue - can you please check if the problem still occurs? Please test with current version from Github: devtools::install_github("ropensci/bib2df")