diff --git a/.gitignore b/.gitignore index 60b2b4f..bf7d482 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +auto/ /vignettes/.RData /vignettes/Inserting_figures_and_evaluated_examples.tex /vignettes/Inserting_bibtex_references.tex diff --git a/DESCRIPTION b/DESCRIPTION index 2ae1cb5..4553923 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: Rdpack Type: Package Title: Update and Manipulate Rd Documentation Objects -Version: 1.0.1 -Date: 2020-07-02 +Version: 2.0.0 +Date: 2020-10-02 Authors@R: c( person(given = c("Georgi", "N."), family = "Boshnakov", role = c("aut", "cre"), @@ -26,8 +26,8 @@ Depends: Imports: tools, utils, - bibtex (>= 0.4.0), - gbRd + gbRd, + rbibutils (>= 1.3) Suggests: grDevices, testthat, @@ -35,4 +35,4 @@ Suggests: rprojroot License: GPL (>= 2) LazyLoad: yes -RoxygenNote: 7.1.0 +RoxygenNote: 7.1.1 diff --git a/NAMESPACE b/NAMESPACE index 2a803e8..a103c55 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,7 +9,8 @@ importFrom(tools, parse_Rd, toRd, checkRd, Rd2txt, #importFrom(grDevices, dev.off, png) importFrom(gbRd, Rd_help2txt) -importFrom(bibtex, read.bib) +#importFrom(bibtex, read.bib) +importFrom(rbibutils, readBib) S3method(as.character, f_usage) S3method(print, f_usage) diff --git a/NEWS.md b/NEWS.md index 56d31a5..de7ef17 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# Rdpack 2.0.0 (CRAN) + +- removed `bibtex` from `Suggests` and elsewhere. + + +# Rdpack 1.1.0 + +- imported `rbibutils` and made suitable adjustments to the code. + +- moved `bibtex` to `Suggests` (since `bibtex` has been orphaned for several years). + + # Rdpack 1.0.1 - removed a documentation link to a function in `gbutils`, which is not among @@ -5,7 +17,7 @@ testing machines. -# Rdpack 1.0.0 +# Rdpack 1.0.0 (CRAN) - `viewRd()` now loads also Rd macros declared by the package to which the rendered Rd file belongs. Previously only macros from `Rdpack` were loaded diff --git a/R/bib.R b/R/bib.R index 3d7b02d..51450d3 100644 --- a/R/bib.R +++ b/R/bib.R @@ -73,11 +73,14 @@ get_bibentries <- function(..., package = NULL, bibfile = "REFERENCES.bib", ## This is really for the case when system.file() is the one from devtools, ## see the note above. TODO: check if this is the case? fn <- system.file("inst", ..., bibfile, package = package) - - if(length(fn) == 1 && fn == "") - ## if system.file() didn't find the bib file, check if file package.bib is - ## provided by package "bibtex" (it is for core R packages, such as "base") - fn <- system.file("bib", sprintf("%s.bib", package), package = "bibtex") + + ## 2020-09-27 removing this functionality since package 'bibtex' ca no longer be + ## relied upon and was dropped from the dependencies. + ## + ## if(length(fn) == 1 && fn == "") + ## ## if system.file() didn't find the bib file, check if file package.bib is + ## ## provided by package "bibtex" (it is for core R packages, such as "base") + ## fn <- system.file("bib", sprintf("%s.bib", package), package = "bibtex") } if(length(fn) > 1){ @@ -109,7 +112,17 @@ get_bibentries <- function(..., package = NULL, bibfile = "REFERENCES.bib", else "UTF-8" - res <- read.bib(file = fn, encoding = encoding) + ## 2020-09-22 switching to 'rbibutils + ## res <- read.bib(file = fn, encoding = encoding) + # rds <- tempfile(fileext = ".rds") + # if(encoding == "UTF-8") + # encoding = "utf8" + # be <- bibConvert(fn, rds, "bibtex", + # "bibentry", encoding = c(encoding, "utf8"), tex = "no_latex") + # res <- readRDS(rds) + # #print(res) + # unlink(rds) + res <- readBib(file = fn, encoding = encoding) # 2018-03-10 commenting out # since bibtex v. >= 0.4.0 has been required for a long time in DESCRIPTION @@ -120,33 +133,71 @@ get_bibentries <- function(..., package = NULL, bibfile = "REFERENCES.bib", # names(res) <- sapply(1:length(res), function(x) bibentry_key(res[[x]][[1]])) # } - for(nam in names(res)){ - ## unconditionaly recode %'s in filed URL - if(!is.null(res[nam]$url)) - res[nam]$url <- gsub("([^\\])%", "\\1\\\\%", res[nam]$url) - - if(url_only){ # process also other fields - ## TODO: currently all unescaped $'s in all fields are recoded; - ## Maybe do it more selectively, e.g. only for %'s inside \url{}, - ## or matching something like http(s):// - fields <- names(unclass(res[nam])[[1]]) - - unclassed <- unclass(res[nam]) - flag <- FALSE - for(field in fields){ - wrk <- unclass(res[nam])[[1]][[field]] - if(is.character(wrk) && any(grepl("([^\\])%", wrk))){ - flag <- TRUE - unclassed[[1]][[field]] <- gsub("([^\\])%", "\\1\\\\%", wrk) - } + ## 2020-10-02 commenting out since taken care (hopefully) by readBib + ## + # for(nam in names(res)){ + # ## unconditionaly recode %'s in filed URL + # if(!is.null(res[nam]$url)) { + # res[nam]$url <- gsub("([^\\])%", "\\1\\\\%", res[nam]$url) + # } + # + # if(url_only){ # process also other fields + # ## TODO: currently all unescaped %'s in all fields are recoded; + # ## Maybe do it more selectively, e.g. only for %'s inside \url{}, + # ## or matching something like http(s):// + # fields <- names(unclass(res[nam])[[1]]) + # + # unclassed <- unclass(res[nam]) + # flag <- FALSE + # for(field in fields){ + # wrk <- unclass(res[nam])[[1]][[field]] + # if(is.character(wrk) && any(grepl("([^\\])%", wrk))){ + # flag <- TRUE + # unclassed[[1]][[field]] <- gsub("([^\\])%", "\\1\\\\%", wrk) + # } + # } + # if(flag){ + # class(unclassed) <- class(res[nam]) + # res[nam] <- unclassed + # } + # } + # } + + ## new 2020-10-02 - allow \% in url's and doi's in the bib file + for(nam in names(res)){ +#print(res[nam], style = "R") + ## unconditionaly recode %'s in filed URL + if(!is.null(res[nam]$doi)) { + res[nam]$doi <- gsub("([^\\\\])[\\\\]%", "\\1%", res[nam]$doi) } - if(flag){ - class(unclassed) <- class(res[nam]) - res[nam] <- unclassed + + if(!is.null(res[nam]$url)) { + res[nam]$url <- gsub("([^\\\\])[\\\\]%", "\\1%", res[nam]$url) } + + # if(url_only){ # process also other fields + # ## TODO: currently all unescaped %'s in all fields are recoded; + # ## Maybe do it more selectively, e.g. only for %'s inside \url{}, + # ## or matching something like http(s):// + # fields <- names(unclass(res[nam])[[1]]) + # + # unclassed <- unclass(res[nam]) + # flag <- FALSE + # for(field in fields){ + # wrk <- unclass(res[nam])[[1]][[field]] + # if(is.character(wrk) && any(grepl("([^\\])%", wrk))){ + # flag <- TRUE + # unclassed[[1]][[field]] <- gsub("([^\\])%", "\\1\\\\%", wrk) + # } + # } + # if(flag){ + # class(unclassed) <- class(res[nam]) + # res[nam] <- unclassed + # } + # } } - } + ## 2018-03-03 new: class(res) <- c("bibentryRd", class(res)) @@ -315,12 +366,53 @@ Rdo_flatinsert <- function(rdo, val, pos, before = TRUE){ res } -## TODO: auto-deduce 'package'? -insert_ref <- function(key, package = NULL, ...) { # bibfile = "REFERENCES.bib" - if(is.null(package)) + +.get_bibs0 <- function(package, ..., cached_env) { + if(is.null(package)) stop("argument 'package' must be provided") - bibs <- get_bibentries(package = package, ..., stop_on_error = FALSE) + if(!is.null(cached_env)){ + if(is.null(cached_env$refsmat)) + cached_env$refsmat <- matrix(character(0), nrow = 0, ncol = 2) + if(is.null(cached_env$allbibs)) + cached_env$allbibs <- list() + } + + ## if(length(keys) > 1) + ## stop("`keys' must be a character string") + ## + ## if(!cite_only) + ## cached_env$refsmat <- rbind(cached_env$refsmat, c(keys, package)) + ## + ## if(dont_cite) + ## return(character(0)) + + + if(is.null(cached_env)){ + bibs <- get_bibentries(package = package, ..., stop_on_error = FALSE) + }else{ + bibs <- cached_env$allbibs[[package]] + if(is.null(bibs)){ + bibs <- get_bibentries(package = package, ..., stop_on_error = FALSE) + cached_env$allbibs[[package]] <- bibs + } + } + + bibs +} + + +## TODO: auto-deduce 'package'? +## 2020-09-30: changing to cache bib as \insertCite does (new arg. cached_env, etc) +insert_ref <- function(key, package = NULL, ..., cached_env = NULL) { # bibfile = "REFERENCES.bib" + + # 2020-09-30: replaced by a single call + # if(is.null(package)) + # stop("argument 'package' must be provided") + # + # bibs <- get_bibentries(package = package, ..., stop_on_error = FALSE) + # + bibs <- .get_bibs0(package, ..., cached_env = cached_env) if(length(bibs) == 0){ note <- paste0("\"Failed to insert reference with key = ", key, diff --git a/docs/404.html b/docs/404.html index d939e10..a49c9a7 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@
diff --git a/docs/authors.html b/docs/authors.html index f4bf00e..6fbb7f4 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -71,7 +71,7 @@ @@ -116,13 +116,13 @@Boshnakov GN (2020). “Rdpack: Update and Manipulate Rd Documentation Objects.” -doi: 10.5281/zenodo.3925612, R package version 1.0.1. +doi: 10.5281/zenodo.3925612, R package version 2.0.0.
@Misc{, title = {{Rdpack}: Update and Manipulate Rd Documentation Objects}, author = {Georgi N. Boshnakov}, year = {2020}, - note = {R package version 1.0.1}, + note = {R package version 2.0.0}, doi = {10.5281/zenodo.3925612}, }diff --git a/docs/index.html b/docs/index.html index bf793d5..3e9a9f9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -38,7 +38,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index ddfdae0..983522a 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -71,7 +71,7 @@ @@ -114,6 +114,23 @@
NEWS.md
+
+ imported rbibutils
and made suitable adjustments to the code.
moved bibtex
to Suggests
(since bibtex
has been orphaned for several years).
gbutils
, which is not among the dependencies of Rdpack
. This was raising a NOTE on one of the CRAN testing machines.viewRd()
now loads also Rd macros declared by the package to which the rendered Rd file belongs. Previously only macros from Rdpack
were loaded but now there is at least one other package, mathjaxr
, which defines Rd macros.
Romain Francois (2014).
bibtex: bibtex parser.
-R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
Duncan Murdoch (2010).
+R package version 0.4.0.
Duncan Murdoch (2010).
“Parsing Rd files.”
https://developer.r-project.org/parseRd.pdf.
Romain Francois (2014).
bibtex: bibtex parser.
-R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
Duncan Murdoch (2010).
+R package version 0.4.0.
Duncan Murdoch (2010).
“Parsing Rd files.”
https://developer.r-project.org/parseRd.pdf.
Package: | Rdpack |
Type: | Package |
Version: | 1.0.1 |
Date: | 2020-07-02 |
Version: | 2.0.0 |
Date: | 2020-10-02 |
License: | GPL (>= 2) |
LazyLoad: | yes |
Built: | R 4.0.1; ; 2020-07-02 08:12:52 UTC; unix |
Built: | R 4.0.2; ; 2020-10-03 09:03:30 UTC; unix |
@@ -167,7 +167,7 @@
A set of functions and macros support inclusion of references and citations from BibTeX files in R documentation (Rd and roxygen2). These tools use only facilities provided by base R and - package bibtex (Francois 2014) + package rbibutils (Francois 2014) .
There are also convenience macros for inclusion of evaluated examples and graphs, which hide some of the hassle of doing this directly with @@ -455,15 +455,14 @@
---
Romain Francois (2014).
bibtex: bibtex parser.
-R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
Duncan Murdoch (2010).
+R package version 0.4.0.
Duncan Murdoch (2010).
“Parsing Rd files.”
https://developer.r-project.org/parseRd.pdf.
Hadley Wickham, Jim Hester, Winston Chang (2018).
devtools: Tools to Make Developing R Packages Easier.
-R package version 1.13.5, https://CRAN.R-project.org/package=devtools.
A. ZZZ (2018).
+R package version 1.13.5, https://CRAN.R-project.org/package=devtools.
A ZZZ (2018).
“A relation between several fundamental constants: \(e^{i\pi}=-1\).”
A non-existent journal with the formula \(L_2\) in its name..
-This reference does not exist. It is a test/demo that simple formulas in BibTeX
- files are OK. A formula in field 'note': \(c^2 = a^2 + b^2\).
## The examples below show typical use but are not executable. diff --git a/docs/reference/Rdpack_bibstyles.html b/docs/reference/Rdpack_bibstyles.html index ed5f961..0044d2b 100644 --- a/docs/reference/Rdpack_bibstyles.html +++ b/docs/reference/Rdpack_bibstyles.html @@ -72,7 +72,7 @@diff --git a/docs/reference/Rdreplace_section.html b/docs/reference/Rdreplace_section.html index 9aef452..5f9d2df 100644 --- a/docs/reference/Rdreplace_section.html +++ b/docs/reference/Rdreplace_section.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/S4formals.html b/docs/reference/S4formals.html index cc0a05a..ed10682 100644 --- a/docs/reference/S4formals.html +++ b/docs/reference/S4formals.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/append_to_Rd_list.html b/docs/reference/append_to_Rd_list.html index dfc589b..9e101d2 100644 --- a/docs/reference/append_to_Rd_list.html +++ b/docs/reference/append_to_Rd_list.html @@ -75,7 +75,7 @@ diff --git a/docs/reference/bibentry_key.html b/docs/reference/bibentry_key.html index c44ceac..c472250 100644 --- a/docs/reference/bibentry_key.html +++ b/docs/reference/bibentry_key.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/c_Rd.html b/docs/reference/c_Rd.html index c9cf4f0..23211b9 100644 --- a/docs/reference/c_Rd.html +++ b/docs/reference/c_Rd.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/char2Rdpiece.html b/docs/reference/char2Rdpiece.html index 4667905..234979d 100644 --- a/docs/reference/char2Rdpiece.html +++ b/docs/reference/char2Rdpiece.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/compare_usage1.html b/docs/reference/compare_usage1.html index 7342ea0..b85c0b0 100644 --- a/docs/reference/compare_usage1.html +++ b/docs/reference/compare_usage1.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/deparse_usage.html b/docs/reference/deparse_usage.html index 233c0e0..539bdf4 100644 --- a/docs/reference/deparse_usage.html +++ b/docs/reference/deparse_usage.html @@ -75,7 +75,7 @@ diff --git a/docs/reference/ereprompt.html b/docs/reference/ereprompt.html index f0d3229..a35795b 100644 --- a/docs/reference/ereprompt.html +++ b/docs/reference/ereprompt.html @@ -73,7 +73,7 @@ diff --git a/docs/reference/format_funusage.html b/docs/reference/format_funusage.html index 5e52348..97969c7 100644 --- a/docs/reference/format_funusage.html +++ b/docs/reference/format_funusage.html @@ -73,7 +73,7 @@ diff --git a/docs/reference/get_bibentries.html b/docs/reference/get_bibentries.html index fd75526..c5bb8c4 100644 --- a/docs/reference/get_bibentries.html +++ b/docs/reference/get_bibentries.html @@ -72,7 +72,7 @@ @@ -154,9 +154,10 @@Details -
get_bibentries
parses the specified file usingread.bib
- from package bibtex (Francois 2014) - and sets its +
get_bibentries
parses the specified file. + + + and sets itsnames
attribute to the keys of the bib elements (read.bib()
does this since version version 0.4.0 of bibtex, as well). Here is what @@ -199,14 +200,16 @@Value
a bibentryRd object inheriting from bibentry
References
-Romain Francois (2014). -bibtex: bibtex parser. -R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
+There are no references for Rd macro
\insertAllCites
on this help page.Examples
-r <- get_bibentries(package = "Rdpack") -r#> Francois R (2014). _bibtex: bibtex parser_. R package version 0.4.0, -#> <URL: https://CRAN.R-project.org/package=bibtex>. ++##: [2] "signature(object = \"classGeneratorFunction\")" +##: [3] "signature(object = \"classRepresentation\")" +##: [4] "signature(object = \"envRefClass\")" +##: [5] "signature(object = \"externalRefMethod\")" +##: [6] "signature(object = \"genericFunction\")"r <- get_bibentries(package = "Rdpack")#> +#> count_type: +#> +#> no_type not_char Manual Misc Article +#> 0 0 2 1 1 +#> +#>r#> Francois R (2014). _bibtex: bibtex parser_. R package version 0.4.0. #> #> Murdoch D (2010). “Parsing Rd files.” <URL: #> https://developer.r-project.org/parseRd.pdf>. @@ -221,7 +224,7 @@Examp #> formulas in BibTeX files are OK. A formula in field 'note': $c^2 = a^2 #> + b^2$.
#> <p>Francois R (2014). #> <em>bibtex: bibtex parser</em>. -#> R package version 0.4.0, <a href="https://CRAN.R-project.org/package=bibtex">https://CRAN.R-project.org/package=bibtex</a>. +#> R package version 0.4.0. #> </p> #> #> <p>Murdoch D (2010). @@ -237,37 +240,24 @@Examp #> <p>ZZZ A (2018). #> “A relation between several fundamental constants: $e^i\pi=-1$.” #> <em>A non-existent journal with the formula $L_2$ in its name.</em>. -#> This reference does not exist. It is a test/demo that simple formulas in BibTeX -#> files are OK. A formula in field 'note': $c^2 = a^2 + b^2$. +#> This reference does not exist. It is a test/demo that simple formulas in BibTeX files are OK. A formula in field 'note': $c^2 = a^2 + b^2$. #> </p>
#> bibentry(bibtype = "Book", -#> key = "sakamoto+ishiguro+kitagawa:1986", -#> author = c(person(given = "Y.", -#> family = "Sakamoto"), -#> person(given = "M.", -#> family = "Ishiguro"), -#> person(given = "Kitagawa", -#> family = "G.")), -#> year = "1986", -#> title = "Akaike Information Criterion Statistics", -#> publisher = "Reidel Publishing Company")#> -#> Sakamoto Y, Ishiguro M, G. K (1986). _Akaike Information Criterion -#> Statistics_. Reidel Publishing Company. +## Bib from base R packages are disabled in Rdpack v2 (notify the +## maintainer of Rdpack or raise an issue on github if you wish this back). +## +## b <- get_bibentries(package = "stats") +## print(b[[1]], style = "R") +## print(b[[1]], style = "citation") + +## here the url field contains percent encoding +fn_url <- system.file("examples", "url_with_percents.bib", package = "Rdpack") +u <- get_bibentries(bibfile = fn_url)#> +#> count_type: #> -#> A BibTeX entry for LaTeX users is +#> no_type not_char Article +#> 0 0 1 #> -#> @Book{sakamoto+ishiguro+kitagawa:1986, -#> author = {Y. Sakamoto and M. Ishiguro and Kitagawa G.}, -#> year = {1986}, -#> title = {Akaike Information Criterion Statistics}, -#> publisher = {Reidel Publishing Company}, -#> } #>-## here the url field contains percent encoding -fn_url <- system.file("examples", "url_with_percents.bib", package = "Rdpack") -u <- get_bibentries(bibfile = fn_url) - ## the links produced by all of the following are valid ## and can be put in a browser print(u, style = "html")#> <p>Boshnakov GN (2018). @@ -275,22 +265,27 @@Examp #> <em>Example bibtex file</em>, <b>51</b>, 1–1. #> <a href="https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib">https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib</a>. #> </p>
#> @Article{urlWithPercents, +#> author = {Georgi N Boshnakov}, #> title = {Dummy example of {URL} with percents}, -#> volume = {51}, -#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, -#> journal = {Example bibtex file}, -#> author = {Georgi N. Boshnakov}, #> year = {2018}, +#> genre = {academic journal}, +#> journal = {Example bibtex file}, +#> citekey = {urlWithPercents}, +#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, +#> volume = {51}, #> pages = {1--1}, #> }#> bibentry(bibtype = "Article", #> key = "urlWithPercents", +#> author = person(given = c("Georgi", "N"), +#> family = "Boshnakov", +#> role = "aut"), #> title = "Dummy example of {URL} with percents", -#> volume = "51", -#> url = "https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib", -#> journal = "Example bibtex file", -#> author = person(given = c("Georgi", "N."), -#> family = "Boshnakov"), #> year = "2018", +#> genre = "academic journal", +#> journal = "Example bibtex file", +#> citekey = "urlWithPercents", +#> url = "https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib", +#> volume = "51", #> pages = "1--1")#> Boshnakov GN (2018). “Dummy example of URL with percents.” _Example #> bibtex file_, *51*, 1-1. <URL: #> https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib>.#> @@ -301,12 +296,14 @@Examp #> A BibTeX entry for LaTeX users is #> #> @Article{urlWithPercents, +#> author = {Georgi N Boshnakov}, #> title = {Dummy example of {URL} with percents}, -#> volume = {51}, -#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, -#> journal = {Example bibtex file}, -#> author = {Georgi N. Boshnakov}, #> year = {2018}, +#> genre = {academic journal}, +#> journal = {Example bibtex file}, +#> citekey = {urlWithPercents}, +#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, +#> volume = {51}, #> pages = {1--1}, #> } #>
@@ -319,28 +316,38 @@Examp #> \url{https://github.com/GeoBosh/zzfiles/blob/master/url\%20with\%20percents.bib}.
## here the journal field contains percent encoding fn_other <- system.file("examples", "journal_with_percents.bib", package = "Rdpack") -j <- get_bibentries(bibfile = fn_url) -print(j, style = "html")#> <p>Boshnakov GN (2018). +j <- get_bibentries(bibfile = fn_url)#> +#> count_type: +#> +#> no_type not_char Article +#> 0 0 1 +#> +#>#> <p>Boshnakov GN (2018). #> “Dummy example of URL with percents.” #> <em>Example bibtex file</em>, <b>51</b>, 1–1. #> <a href="https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib">https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib</a>. #> </p>#> @Article{urlWithPercents, +#> author = {Georgi N Boshnakov}, #> title = {Dummy example of {URL} with percents}, -#> volume = {51}, -#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, -#> journal = {Example bibtex file}, -#> author = {Georgi N. Boshnakov}, #> year = {2018}, +#> genre = {academic journal}, +#> journal = {Example bibtex file}, +#> citekey = {urlWithPercents}, +#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, +#> volume = {51}, #> pages = {1--1}, #> }#> bibentry(bibtype = "Article", #> key = "urlWithPercents", +#> author = person(given = c("Georgi", "N"), +#> family = "Boshnakov", +#> role = "aut"), #> title = "Dummy example of {URL} with percents", -#> volume = "51", -#> url = "https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib", -#> journal = "Example bibtex file", -#> author = person(given = c("Georgi", "N."), -#> family = "Boshnakov"), #> year = "2018", +#> genre = "academic journal", +#> journal = "Example bibtex file", +#> citekey = "urlWithPercents", +#> url = "https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib", +#> volume = "51", #> pages = "1--1")#> Boshnakov GN (2018). “Dummy example of URL with percents.” _Example #> bibtex file_, *51*, 1-1. <URL: #> https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib>.#> @@ -351,12 +358,14 @@Examp #> A BibTeX entry for LaTeX users is #> #> @Article{urlWithPercents, +#> author = {Georgi N Boshnakov}, #> title = {Dummy example of {URL} with percents}, -#> volume = {51}, -#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, -#> journal = {Example bibtex file}, -#> author = {Georgi N. Boshnakov}, #> year = {2018}, +#> genre = {academic journal}, +#> journal = {Example bibtex file}, +#> citekey = {urlWithPercents}, +#> url = {https://github.com/GeoBosh/zzfiles/blob/master/url%20with%20percents.bib}, +#> volume = {51}, #> pages = {1--1}, #> } #>
diff --git a/docs/reference/get_sig_text.html b/docs/reference/get_sig_text.html index 4f13927..c9a8699 100644 --- a/docs/reference/get_sig_text.html +++ b/docs/reference/get_sig_text.html @@ -75,7 +75,7 @@@@ -152,11 +152,11 @@Details rdo <- utils:::.getHelpFile(fn) head(get_sig_text(rdo)) ##: [1] "signature(object = \"ANY\")" -##: [2] "signature(object = \"C++Class\")" -##: [3] "signature(object = \"C++Function\")" -##: [4] "signature(object = \"C++Object\")" -##: [5] "signature(object = \"classGeneratorFunction\")" -##: [6] "signature(object = \"classRepresentation\")"
Value
A character vector with one element for each method.
@@ -181,11 +181,11 @@Examp ## this will find all methods for "show" in currently loaded packages ## (print only some of them) head(get_sig_text(rdo))
#> [1] "signature(object = \"ANY\")" -#> [2] "signature(object = \"C++Class\")" -#> [3] "signature(object = \"C++Function\")" -#> [4] "signature(object = \"C++Object\")" -#> [5] "signature(object = \"classGeneratorFunction\")" -#> [6] "signature(object = \"classRepresentation\")"+#> [2] "signature(object = \"classGeneratorFunction\")" +#> [3] "signature(object = \"classRepresentation\")" +#> [4] "signature(object = \"envRefClass\")" +#> [5] "signature(object = \"externalRefMethod\")" +#> [6] "signature(object = \"genericFunction\")"## this will select only the ones from package "stats4" get_sig_text(rdo, package = "stats4")#> [1] "signature(object = \"mle\")" "signature(object = \"summary.mle\")"## this is also fine (interactively) but need to choose @@ -214,7 +214,7 @@Examp #> Rd source not supplied and installed documentation not found. #> Trying a 'prompt' function to generate documentation for the object. #> success: documentation generated using a 'prompt' function. -#> The Rd content was written to file /tmp/RtmpYaQyun/file1a37c3378299c
#> [1] "/tmp/RtmpYaQyun/file1a37c3378299c"rdo <- tools::parse_Rd(fn) +#> The Rd content was written to file /tmp/RtmpNJZtUt/file1b5c4531a13cf7#> [1] "/tmp/RtmpNJZtUt/file1b5c4531a13cf7"#> [1] "signature(x = \"ANY\")"setClass("aRdpack") setClass("bRdpack") @@ -229,7 +229,7 @@Examp #> Rd source not supplied and installed documentation not found. #> Trying a 'prompt' function to generate documentation for the object. #> success: documentation generated using a 'prompt' function. -#> The Rd content was written to file /tmp/RtmpYaQyun/file1a37c3378299c
#> [1] "/tmp/RtmpYaQyun/file1a37c3378299c"rdo <- tools::parse_Rd(fn) +#> The Rd content was written to file /tmp/RtmpNJZtUt/file1b5c4531a13cf7#> [1] "/tmp/RtmpNJZtUt/file1b5c4531a13cf7"#> [1] "signature(x = \"ANY\", y = \"ANY\")" #> [2] "signature(x = \"aRdpack\", y = \"bRdpack\")" #> [3] "signature(x = \"aRdpack\", y = \"numeric\")" diff --git a/docs/reference/get_usage_text.html b/docs/reference/get_usage_text.html index 17b6e72..d96f3d8 100644 --- a/docs/reference/get_usage_text.html +++ b/docs/reference/get_usage_text.html @@ -72,7 +72,7 @@diff --git a/docs/reference/index.html b/docs/reference/index.html index 780485b..d4e758f 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -71,7 +71,7 @@ diff --git a/docs/reference/insert_all_ref.html b/docs/reference/insert_all_ref.html index f91876d..1c8f788 100644 --- a/docs/reference/insert_all_ref.html +++ b/docs/reference/insert_all_ref.html @@ -72,7 +72,7 @@ @@ -168,32 +168,52 @@R
There are no references for Rd macro
\insertAllCites
on this help page.Examples
-@@ -132,7 +132,7 @@#> Murdoch D (2009). “Parsing Rd files.” <URL: -#> http://developer.r-project.org/parseRd.pdf>.++#> This reference does not exist. It is a test/demo that simple formulas in BibTeX files are OK. A formula in field 'note': \eqn{c^2 = a^2 + b^2}.## bibs <- bibtex::read.bib(package = "tools") +## bibs + ## a reference from package Rdpack -cat(insert_all_ref(matrix(c("Rpack:bibtex", "Rdpack"), ncol = 2)), "\n")#> Romain Francois (2014). +cat(insert_all_ref(matrix(c("Rpack:bibtex", "Rdpack"), ncol = 2)), "\n")#> +#> count_type: +#> +#> no_type not_char Manual Misc Article +#> 0 0 2 1 1 +#> +#> +#> Romain Francois (2014). #> \emph{bibtex: bibtex parser}. -#> R package version 0.4.0, \url{https://CRAN.R-project.org/package=bibtex}.+#> R package version 0.4.0.## more than one reference from package Rdpack, separate the keys with commas -cat(insert_all_ref(matrix(c("parseRd,Rpack:bibtex", "Rdpack"), ncol = 2)), "\n")#> Romain Francois (2014). +cat(insert_all_ref(matrix(c("parseRd,Rpack:bibtex", "Rdpack"), ncol = 2)), "\n")#> +#> count_type: +#> +#> no_type not_char Manual Misc Article +#> 0 0 2 1 1 +#> +#> +#> Romain Francois (2014). #> \emph{bibtex: bibtex parser}. -#> R package version 0.4.0, \url{https://CRAN.R-project.org/package=bibtex}.\cr\cr Duncan Murdoch (2010). +#> R package version 0.4.0.\cr\cr Duncan Murdoch (2010). #> \dQuote{Parsing Rd files.} #> \url{https://developer.r-project.org/parseRd.pdf}.## all references from package Rdpack -cat(insert_all_ref(matrix(c("*", "Rdpack"), ncol = 2)), "\n")#> +#> count_type: +#> +#> no_type not_char Manual Misc Article +#> 0 0 2 1 1 +#> +#> +#> Romain Francois (2014). #> \emph{bibtex: bibtex parser}. -#> R package version 0.4.0, \url{https://CRAN.R-project.org/package=bibtex}.\cr\cr Duncan Murdoch (2010). +#> R package version 0.4.0.\cr\cr Duncan Murdoch (2010). #> \dQuote{Parsing Rd files.} #> \url{https://developer.r-project.org/parseRd.pdf}.\cr\cr Hadley Wickham, Jim Hester, Winston Chang (2018). #> \emph{devtools: Tools to Make Developing R Packages Easier}. -#> R package version 1.13.5, \url{https://CRAN.R-project.org/package=devtools}.\cr\cr A. ZZZ (2018). +#> R package version 1.13.5, \url{https://CRAN.R-project.org/package=devtools}.\cr\cr A ZZZ (2018). #> \dQuote{A relation between several fundamental constants: \eqn{e^{i\pi}=-1}.} #> \emph{A non-existent journal with the formula \eqn{L_2} in its name.}. -#> This reference does not exist. It is a test/demo that simple formulas in BibTeX -#> files are OK. A formula in field 'note': \eqn{c^2 = a^2 + b^2}.Insert bibtex references in Rd and roxygen2 documentation
vignette. -insert_ref(key, package = NULL, ...)+insert_ref(key, package = NULL, ..., cached_env = NULL)Arguments
... | further arguments to pass on to |
+
---|---|
cached_env | +environment, used to avoid repeatedly pasing the bib + file from scratch, mainly useful by the Rd macros. |
+
Romain Francois (2014). bibtex: bibtex parser. -R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
-R Development Core Team (2009). -R: A Language and Environment for Statistical Computing. -R Foundation for Statistical Computing, Vienna, Austria. -ISBN 3-900051-07-0, https://www.R-project.org.
+R package version 0.4.0. +----
The following references are obtained with a single \insertAllCited{}
:
Romain Francois (2014).
bibtex: bibtex parser.
-R package version 0.4.0, https://CRAN.R-project.org/package=bibtex.
Duncan Murdoch (2010).
+R package version 0.4.0.
Duncan Murdoch (2010).
“Parsing Rd files.”
https://developer.r-project.org/parseRd.pdf.
Rdpack-package
for overview,
the vignettes
diff --git a/docs/reference/inspect_args.html b/docs/reference/inspect_args.html index c2a7a7d..b2b032a 100644 --- a/docs/reference/inspect_args.html +++ b/docs/reference/inspect_args.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/inspect_signatures.html b/docs/reference/inspect_signatures.html index 51595ec..ebbaa8c 100644 --- a/docs/reference/inspect_signatures.html +++ b/docs/reference/inspect_signatures.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/inspect_slots.html b/docs/reference/inspect_slots.html index e34872d..a23f3e0 100644 --- a/docs/reference/inspect_slots.html +++ b/docs/reference/inspect_slots.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/inspect_usage.html b/docs/reference/inspect_usage.html index bd6bafe..114606a 100644 --- a/docs/reference/inspect_usage.html +++ b/docs/reference/inspect_usage.html @@ -72,7 +72,7 @@ diff --git a/docs/reference/list_Rd.html b/docs/reference/list_Rd.html index 1263de0..690c367 100644 --- a/docs/reference/list_Rd.html +++ b/docs/reference/list_Rd.html @@ -72,7 +72,7 @@ @@ -178,7 +178,7 @@#> R Development Core Team (2009). -#> \emph{R: A Language and Environment for Statistical Computing}. -#> R Foundation for Statistical Computing, Vienna, Austria. -#> ISBN 3-900051-07-0, \url{https://www.R-project.org}.