@@ -42,9 +42,23 @@ function(keys)
4242{
4343 keys <- keys [nzchar(keys )]
4444 bad <- character ()
45- if (! any(ind <- grepl(" ::" , keys , fixed = TRUE ))) {
45+ ind <- grepl(" ::" , keys , fixed = TRUE )
46+ brp <- if (! all(ind )) {
47+ # # Bibentries for base R and current package maybe.
48+ rdfile <- processRdChunk_data_store()$ Rdfile
49+ dir <- dirname(normalizePath(rdfile , mustWork = FALSE ))
50+ if (basename(dir ) %in% c(" unix" , " windows" ))
51+ dir <- dirname(dir )
52+ dir <- if (basename(dir ) == " man" ) {
53+ dir <- dirname(dir )
54+ c(dir , file.path(dir , " inst" ))
55+ } else character ()
56+ c(R_bibentries(),
57+ .bibentries_from_REFERENCES(dir ))
58+ } else NULL
59+ if (! any(ind )) {
4660 # # Special-case for efficiency.
47- bib <- R_bibentries()
61+ bib <- brp
4862 pos <- match(keys , .bibentry_get_key(bib ),
4963 nomatch = 0L )
5064 bad <- keys [pos == 0L ]
@@ -58,19 +72,11 @@ function(keys)
5872 for (j in seq_along(i )) {
5973 pj <- names(i )[j ]
6074 bib <- if (! nzchar(pj ))
61- R_bibentries()
62- else if (nzchar(path <- system.file(" REFERENCES.rds" ,
63- package = pj )))
64- readRDS(path )
65- else if (nzchar(path <- system.file(" REFERENCES.R" ,
66- package = pj )))
67- utils :: readCitationFile(path ,
68- list (Encoding = " UTF-8" ))
69- else if (nzchar(path <- system.file(" REFERENCES.bib" ,
70- package = pj )))
71- `names<-`(bibtex :: read.bib(path ), NULL )
72- else
73- utils :: bibentry()
75+ brp
76+ else {
77+ dir <- system.file(package = pj )
78+ .bibentries_from_REFERENCES(dir )
79+ }
7480 kj <- keys [i [[j ]]]
7581 pos <- match(sub(" .*::" , " " , kj ),
7682 .bibentry_get_key(bib ),
@@ -93,6 +99,21 @@ function(keys)
9399 y
94100}
95101
102+ .bibentries_from_REFERENCES <-
103+ function (dir )
104+ {
105+ for (d in dir [nzchar(dir )]) {
106+ if (file.exists(path <- file.path(d , " REFERENCES.rds" )))
107+ return (readRDS(path ))
108+ else if (file.exists(path <- file.path(d , " REFERENCES.R" )))
109+ return (utils :: readCitationFile(path ,
110+ list (Encoding = " UTF-8" )))
111+ else if (file.exists(path <- file.path(d , " REFERENCES.bib" )))
112+ return (`names<-`(bibtex :: read.bib(path ), NULL ))
113+ }
114+ utils :: bibentry()
115+ }
116+
96117.bibentries_from_bibtex <-
97118function (file , text )
98119{
0 commit comments