diff --git a/.Rbuildignore b/.Rbuildignore index 6321843..1b19aec 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -17,3 +17,4 @@ ^_pkgdown\.yml$ ^docs$ ^\.github$ +^\.git$ diff --git a/DESCRIPTION b/DESCRIPTION index 35df4f1..6bbf366 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Rdpack Type: Package Title: Update and Manipulate Rd Documentation Objects -Version: 2.6.9000 +Version: 2.6.1.9000 Authors@R: c( person(given = c("Georgi", "N."), family = "Boshnakov", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index f194b4a..18f0271 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# Rdpack 2.6.1 + +- R-devel c86938 turned to error the warning for a non-existing key in the bib + file. Fixed `insert_bib` (and a related test) to handle that. + + # Rdpack 2.6 - fixed issues causing 'lost braces' (actually, superfluous braces) NOTEs from @@ -47,14 +53,14 @@ files. (addresses issue #26) -# Rdpack 2.3.1 (CRAN) +# Rdpack 2.3.1 - in Rd macro `\insertCite`, two or more accented Latin characters were rendered with superfluous curly braces, see issue#25 (reported by Manuel López-Ibáñez) and https://stat.ethz.ch/pipermail/r-devel/2022-April/081604.html. -# Rdpack 2.3 (CRAN) +# Rdpack 2.3 - reverted the change in v2.2, since a further fix in R-devel, https://stat.ethz.ch/pipermail/r-devel/2022-March/081570.html, made it @@ -65,14 +71,14 @@ accidentally with `Rdpack 2.2`. -# Rdpack 2.2 (CRAN) +# Rdpack 2.2 - a change in R-devel (around built r81914, March 2022) in the processing of `\doi` Rd macros resulted in warnings from R-devel's checks for packages that use Rdpack built with the released versions of R. This fixes it. (fixes #24) -# Rdpack 2.1.4 (CRAN) +# Rdpack 2.1.4 - Rdmacro `\insertCite` gets a new feature allowing to drop parentheses for parenthesised citations, analogous to natbib's `\citealp` in latex. This makes @@ -84,7 +90,7 @@ - the pkgdown site now has a `Search` button on the navigation bar. -# Rdpack 2.1.3 (CRAN) +# Rdpack 2.1.3 - fixed a test that was failing with versions of rbibutils before v2.1.1 (issue reported by Andreas Tille). @@ -96,7 +102,7 @@ GeoBosh/bibutils#7 and NEWS.md in rbibutils v2.2.4 and v2.2.5. -# Rdpack 2.1.2 (CRAN) +# Rdpack 2.1.2 - Rdmacros generating references now drop the `URL` field if a `doi` field generating the same URL is present. This avoids repetition of the URL since @@ -117,7 +123,7 @@ (although that needs fixing also for `direct = FALSE`). -# Rdpack 2.1.1 (CRAN) +# Rdpack 2.1.1 - In `viewRd`, the default for the help type now is `options("help_type")` (previously the default was `"text"`). @@ -133,7 +139,7 @@ circa February 2021). -# Rdpack 2.1 (CRAN) +# Rdpack 2.1 - dramatic speed up of processing of bibliography references, most noticeable for users with large number of help pages and large `REFERENCES.bib`. @@ -146,26 +152,26 @@ - corrected wrong citation of `rbibutils`. -# Rdpack 2.0 (CRAN) +# Rdpack 2.0 - removed `bibtex` from `Suggests` and elsewhere. -# Rdpack 1.1.0 +# Rdpack 1.1.0 (not on CRAN) - 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 +# Rdpack 1.0.1 (not on CRAN) - removed a documentation link to a function in `gbutils`, which is not among the dependencies of `Rdpack`. This was raising a NOTE on one of the CRAN testing machines. -# Rdpack 1.0.0 (CRAN) +# Rdpack 1.0.0 - `viewRd()` now loads also Rd macros declared by the package to which the rendered Rd file belongs. Previously only macros from `Rdpack` were loaded @@ -177,7 +183,7 @@ - edited some documentation files. -# Rdpack 0.11-1 (CRAN) +# Rdpack 0.11-1 - in documentation of S4 classes, such as `"classname-class.Rd"`, `reprompt()` was sometimes inserting entries for slots already listed in the Slots @@ -207,7 +213,7 @@ `R CMD check`. -# Rdpack 0.11-0 (CRAN) +# Rdpack 0.11-0 - Updated the vignette about `\insertFig`, `\printExample` and `\runExamples`, to reflect the lifting in `R 3.6.0` of some limitations of Rd processing in @@ -223,14 +229,14 @@ -# Rdpack 0.10-3 +# Rdpack 0.10-3 (not on CRAN) * fixed issue#9 (reported by by @aravind-j) appearing when a package is built with R-devel (since about Oct 2018) causing references by `\insertAllCited{}` to appear in a single paragraph in the `html` rendering of the Rd documentation. -# Rdpack 0.10-2 +# Rdpack 0.10-2 (not on CRAN) * added pkgdown site to DESCRIPTION. @@ -248,17 +254,17 @@ * Started moving tests from my local setup to testthat. -# Rdpack 0.10-1 (CRAN) +# Rdpack 0.10-1 * removed redundant references from REFERENCES.bib (they were leftovers from testing). -# Rdpack 0.10-0 +# Rdpack 0.10-0 (not on CRAN) * updated vignette 'Inserting_bibtex_references'. -# Rdpack 0.9-1 +# Rdpack 0.9-1 (not on CRAN) * now `REFERENCES.bib` is read-in using the declared encoding for the corresponding package. If there is no declared encoding, "UTF-8" is assumed. @@ -312,18 +318,18 @@ be needed if the symbols are imported by the package.) -# Rdpack 0.9-0 (CRAN) +# Rdpack 0.9-0 * some brush-up of the documentation for the changes since version 0.8-0 of the package. -# Rdpack 0.8-4 +# Rdpack 0.8-4 (not on CRAN) * now simple mathematics in BibTeX entries is rendered natively, no need to replace dollars with `\eqn{}`. -# Rdpack 0.8-3 +# Rdpack 0.8-3 (not on CRAN) * new macro `\printExample` for inclusion of example computations in narrative sections, such as `Details`. The code is evaluated and printed similarly to `R` sessions but the code is @@ -353,19 +359,19 @@ * new vignette gives a brief description of the new macros. -# Rdpack 0.8-2 +# Rdpack 0.8-2 (not on CRAN) * Now text citations use "et al." when there are three or more authors. (Issue#6 reported by Timothy P. Bilton) -# Rdpack 0.8-1 +# Rdpack 0.8-1 (not on CRAN) * in this file, added backticks to `\insertRef` and `\insertAllCited` (see below) - in the rendered `News` on CRAN the backslashed words had disappeared. -# Rdpack 0.8-0 (CRAN) +# Rdpack 0.8-0 * `\insertRef` and `\insertAllCited` macros now support `bibstyles` for formatting references (feature requested by Jamie Halliday, issue#5). Use @@ -378,7 +384,7 @@ -# Rdpack 0.7-1 +# Rdpack 0.7-1 (not on CRAN) * improvements to handling of free form citations in textual mode: @@ -392,7 +398,7 @@ * fix a bug in `Rdo_locate_core_section()`. -# Rdpack 0.7-0 (CRAN) +# Rdpack 0.7-0 * consolidated the changes introduced since the previous CRAN release of Rdpack (it was 0.5-5) in preparation for the next release. Users of the new macros @@ -409,7 +415,7 @@ explaining what was amiss (currently with 'author' A Adummy). -# Rdpack 0.6-x +# Rdpack 0.6-x (not on CRAN) * new Rd macros for citations @@ -428,7 +434,7 @@ * updates to the documentation. -# Rdpack 0.5-7 +# Rdpack 0.5-7 (not on CRAN) * `get_bibentries()` gets a new argument "everywhere". When is is TRUE, the default, unescaped percents are escaped in all bibtex fields, otherwise the @@ -442,7 +448,7 @@ * cleaned up the imports in NAMESPACE. -# Rdpack 0.5-6 +# Rdpack 0.5-6 (not on CRAN) * `insert_ref()` and Rd macro `\insertRef` should now work ok in the presence of percent encoded symbols in URL field of a BibTeX entry. Closes issue @@ -464,7 +470,7 @@ packages.) -# Rdpack 0.5-5 (CRAN) +# Rdpack 0.5-5 * Streamlined the help page of `reprompt()` and `Rdpack-package`. @@ -496,7 +502,7 @@ selected object name and works on it if found, otherwise creates one. -# Rdpack 0.5-4 +# Rdpack 0.5-4 (not on CRAN) * added the version of `Rdpack` to the abstract of the vignette. This seems more informative than giving the compilation date. @@ -510,13 +516,13 @@ the signature of a function in "Usage" section was empty. -# Rdpack 0.5-3 (CRAN) +# Rdpack 0.5-3 * The warning message about a missing reference key now appears also in the respective help page. -# Rdpack 0.5-2 +# Rdpack 0.5-2 (not on CRAN) * added the github url to DESCRIPTION. @@ -524,19 +530,19 @@ (thanks to Kisung You for suggesting this). -# Rdpack 0.5-1 (CRAN) +# Rdpack 0.5-1 * an example was not restoring the working directory. -# Rdpack 0.5-0 +# Rdpack 0.5-0 (not on CRAN) * moved gbRd from Depends to Imports and adjusted some examples to use `tools::parse_Rd()` rather than `parse_Rd()` (before this was not necessary since 'gbRd' _depended on_ 'tools'). -# Rdpack 0.4-23 +# Rdpack 0.4-23 (not on CRAN) * new function `viewRd()` parses and shows an Rd file in a source package. May be particularly helpful for devtools developers. @@ -546,7 +552,7 @@ * new functions `makeVignetteReference()` and `vigbib()` generate Bibtex references for vignettes in a package. -# Rdpack 0.4-22 (CRAN) +# Rdpack 0.4-22 * Added the requirement to **Import Rdpack** to the help page of `insert_ref()`. (It was out of sync with the vignette.) @@ -558,7 +564,7 @@ roxygen2 example. -# Rdpack 0.4-21 (CRAN) +# Rdpack 0.4-21 * Edited and amended vignette _"Inserting_bibtex_references"_, including: @@ -571,12 +577,12 @@ * changed the URL for parse_Rd.pdf in REFERENCES.bib to https. -# Rdpack 0.4-20 (CRAN) +# Rdpack 0.4-20 * cleaned up some minor CRAN issues. -# Rdpack 0.4-19 +# Rdpack 0.4-19 (not on CRAN) * new facility for inserting references from BibTeX files - just put the line: @@ -589,20 +595,20 @@ details. -# Rdpack 0.4-18 (CRAN) +# Rdpack 0.4-18 -* from now on, put (CRAN) next to versions published on CRAN (as above) +* from now on, put next to versions published on CRAN (as above) * a minor correction in file NEWS. -# Rdpack 0.4-17 +# Rdpack 0.4-17 (not on CRAN) * In file DESCRIPTION, changed reprompt and rebib to `reprompt()` and `rebib()`. -# Rdpack 0.4-16 +# Rdpack 0.4-16 (not on CRAN) * don't export `parse_text` @@ -617,14 +623,14 @@ not including it triggers warnings) -# Rdpack 0.4-8 +# Rdpack 0.4-8 (not on CRAN) * new functions `.whichtageq` and `.whichtagin`; replaced most calls to `toolsdotdotdotRdTags` with these. * removed `toolsdotdotdotRdTags` -# Rdpack 0.4-7 +# Rdpack 0.4-7 (not on CRAN) * removed `:::` calls from code; copied some functions from `tools` to achieve this (see "threedots.R"). Renamed the functions replacing `:::` with @@ -635,7 +641,7 @@ * new functions: `Rdo_get_argument_names`, `Rdo_get_item_labels` -# Rdpack 0.4-5 +# Rdpack 0.4-5 (not on CRAN) * dependence `bibtex` becomes "Imports". `tools` and `gbRd` remain (for now) "Depends" since functions from them are used in some examples without @@ -654,7 +660,11 @@ * small changes in the documentation -# Rdpack 0.4-1 + +# Rdpack 0.4-4 + + +# Rdpack 0.4-1 (not on CRAN) * new major feature: processing references from Bibtex files. The top user level function is `rebib()`, which updates section "references" in an Rd @@ -670,7 +680,7 @@ * some gaps in the documentation filled. -# Rdpack 0.3-11 +# Rdpack 0.3-11 (not on CRAN) * `reprompt()` was not handling properly S4 replacement methods. Changed the parsing of the arguments to rectify this. Some other functions also needed @@ -679,8 +689,8 @@ # Rdpack 0.3-10 * `Depends` field in DESCRIPTION file updated to require R 2.15.0 or later - (because of a few uses of `paste0()` in recent code.) + (because of a few uses of `paste0()` in recent code). -# Rdpack 0.3-8 (CRAN) +# Rdpack 0.3-8 * first public version diff --git a/R/bib.R b/R/bib.R index de16dc0..6b29b32 100644 --- a/R/bib.R +++ b/R/bib.R @@ -285,7 +285,7 @@ inspect_Rdbib <- function(rdo, force = FALSE, ...){ # 2013-03-29 # bibstxt <- capture.output(print(bibs, "latex")) # # bibstxt <- .patch_latex(bibstxt) # TODO: krapka! - ## TODO: the bibstyles used beloww should probably be arguments + ## TODO: the bibstyles used below should probably be arguments bibs <- sort(bibs, .bibstyle = "JSSRd") bibstxt <- .toRd_styled(bibs, "Rdpack") # bibstxt <- paste0(bibstxt, collapse = "\\cr\\cr ") @@ -399,110 +399,138 @@ Rdo_flatinsert <- function(rdo, val, pos, before = TRUE){ list(.get_bibs0 = .get_bibs0, .get_all_bibs = .get_all_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) { + ## 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) { - # 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) - # + # 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) + # - # TODO: this is for testing only! - # message("\nkey is ", key) + # TODO: this is for testing only! + # message("\nkey is ", key) - # if(is.null(cached_env)) - # message(" cached_env is NULL") - # else - # message(" cached_env is nonNULL") - - bibs <- .bibs_cache$.get_bibs0(package, ..., cached_env = cached_env) - - if(length(bibs) == 0){ - note <- paste0("\"Failed to insert reference with key = ", key, - " from package = '", package, "'.", - " Possible cause --- missing REFERENCES.bib in package '", - package, "' or '", package, "' not installed.\"" - ) - note <- paste0("\\Sexpr[results=rd,stage=install]{{warning(", note, ");", note, "}} ") - item <- bibentry( - bibtype = "Misc", - title = "Not avalable", - author = person("A", "Adummy"), - year = format(Sys.time(), "%Y"), - note = note, - key = key - ) - .toRd_styled(item, package) - }else if(length(key) == 1){ - item <- tryCatch(bibs[[key]], - warning = function(c) { - if(grepl("subscript out of bounds", c$message)){ - ## tell the user the offending key. - s <- paste0("possibly non-existing key '", key, "'") - c$message <- paste0(c$message, " (", s, ")") - } - warning(c) - # res <- paste0("\nWARNING: failed to insert reference '", key, - # "' from package '", package, "' - ", - # s, ".\n") - # return(res) - ## setup a dummy entry - bibentry( - bibtype = "Misc", - title = "Not avalable", - author = person("A", "Adummy"), - year = format(Sys.time(), "%Y"), - note = paste0("Failed to insert reference with key = ", key, - " from package = '", package, "'.", - " Possible cause --- missing or misspelled key." - ), - key = key - ) - }) - - # # 2018-03-01 Bug: Unexpected END_OF_INPUT error (URL parsing?) #3 - # # I don't know why toRd() doesn't do this... - # # - # # escape percents that are not preceded by backslash - # # (`if' is because in case of error above, item will be simply a string) - # - # Commenting out since get_bibentries() does it. - # if(inherits(item, "bibentry") && !is.null(item$url)) - # item$url <- gsub("([^\\])%", "\\1\\\\%", item$url) - - # if(interactive()) browser() - - # wrk <- .toRd_styled(item, package) # TODO: add styles? (doesn't seem feasible here) - # fn <- tempfile() - # cat(wrk, file = fn) - # res <- permissive_parse_Rd(fn) ## tools::parse_Rd(fn) - # tools::toRd(res) - # - # wrk <- .toRd_styled(item, package) - # Encoding(wrk) <- "bytes" - # wrk - # - .toRd_styled(item, package) - }else{ - ## key is documented to be of length one, nevertheless handle it too - kiki <- FALSE - items <- withCallingHandlers(bibs[[key]], warning = function(w) {kiki <<- TRUE}) - ## TODO: deal with URL's as above - txt <- .toRd_styled(items, package) - - if(kiki){ # warning(s) in bibs[[key]] - s <- paste0("WARNING: failed to insert ", - "one or more of the following keys in REFERENCES.bib:\n", - paste(key, collapse = ", \n"), ".") - warning(s) - txt <- c(txt, s) - } - paste0(paste(txt, collapse = "\n\n"), "\n") - } -} + # if(is.null(cached_env)) + # message(" cached_env is NULL") + # else + # message(" cached_env is nonNULL") + + bibs <- .bibs_cache$.get_bibs0(package, ..., cached_env = cached_env) + + if(length(bibs) == 0){ + note <- paste0("\"Failed to insert reference with key = ", key, + " from package = '", package, "'.", + " Possible cause --- missing REFERENCES.bib in package '", + package, "' or '", package, "' not installed.\"" + ) + note <- paste0("\\Sexpr[results=rd,stage=install]{{warning(", note, ");", note, "}} ") + item <- bibentry( + bibtype = "Misc", + title = "Not avalable", + author = person("A", "Adummy"), + year = format(Sys.time(), "%Y"), + note = note, + key = key + ) + .toRd_styled(item, package) + }else if(length(key) == 1){ + item <- tryCatch(bibs[[key]], + warning = function(c) { + if(grepl("subscript out of bounds", c$message)){ + ## tell the user the offending key. + s <- paste0("possibly non-existing key '", key, "'") + c$message <- paste0(c$message, " (", s, ")") + } + warning(c) + # res <- paste0("\nWARNING: failed to insert reference '", key, + # "' from package '", package, "' - ", + # s, ".\n") + # return(res) + ## setup a dummy entry + bibentry( + bibtype = "Misc", + title = "Not avalable", + author = person("A", "Adummy"), + year = format(Sys.time(), "%Y"), + note = paste0("Failed to insert reference with key = ", key, + " from package = '", package, "'.", + " Possible cause --- missing or misspelled key." + ), + key = key + ) + }, + ## 2024-08-04 + ## R-devel c86938 recently changed the warning to error, + ## for now, copying verbatim the function for handling the warning. + error = function(c) { + if(grepl("subscript out of bounds", c$message)){ + ## tell the user the offending key. + s <- paste0("possibly non-existing key '", key, "'") + c$message <- paste0(c$message, " (", s, ")") + } + warning(c) + # res <- paste0("\nWARNING: failed to insert reference '", key, + # "' from package '", package, "' - ", + # s, ".\n") + # return(res) + ## setup a dummy entry + bibentry( + bibtype = "Misc", + title = "Not avalable", + author = person("A", "Adummy"), + year = format(Sys.time(), "%Y"), + note = paste0("Failed to insert reference with key = ", key, + " from package = '", package, "'.", + " Possible cause --- missing or misspelled key." + ), + key = key + ) + } + ) + + # # 2018-03-01 Bug: Unexpected END_OF_INPUT error (URL parsing?) #3 + # # I don't know why toRd() doesn't do this... + # # + # # escape percents that are not preceded by backslash + # # (`if' is because in case of error above, item will be simply a string) + # + # Commenting out since get_bibentries() does it. + # if(inherits(item, "bibentry") && !is.null(item$url)) + # item$url <- gsub("([^\\])%", "\\1\\\\%", item$url) + + # if(interactive()) browser() + + # wrk <- .toRd_styled(item, package) # TODO: add styles? (doesn't seem feasible here) + # fn <- tempfile() + # cat(wrk, file = fn) + # res <- permissive_parse_Rd(fn) ## tools::parse_Rd(fn) + # tools::toRd(res) + # + # wrk <- .toRd_styled(item, package) + # Encoding(wrk) <- "bytes" + # wrk + # + .toRd_styled(item, package) + }else{ + ## key is documented to be of length one, nevertheless handle it too + kiki <- FALSE + items <- withCallingHandlers(bibs[[key]], warning = function(w) {kiki <<- TRUE}) + ## TODO: deal with URL's as above + txt <- .toRd_styled(items, package) + + if(kiki){ # warning(s) in bibs[[key]] + s <- paste0("WARNING: failed to insert ", + "one or more of the following keys in REFERENCES.bib:\n", + paste(key, collapse = ", \n"), ".") + warning(s) + txt <- c(txt, s) + } + paste0(paste(txt, collapse = "\n\n"), "\n") + } + } ## 2017-11-25 new ## see utils:::print.help_files_with_topic() @@ -1229,16 +1257,11 @@ Rdpack_bibstyles <- local({ ## TODO: check if these 'sapply()' preserves encodings, if set. res <- sapply(bibs, f) - ## 2018-10-08 + if(any(slash_ind <- grepl("\\slash ", res, fixed = TRUE))) { + res[slash_ind] <- gsub("([^{])\\\\slash *", "\\1\\\\ifelse{latex}{\\\\out{\\\\slash }}{/}", + res[slash_ind]) + } - ## TODO: this is risky but read.bib, bibentry, toRd and similar seem to work - ## internally with UTF-8 - ## - ## if(!all(Encoding(res) == "UTF-8")){ - ## # warning(paste("encoding is: ", paste0(Encoding(res), collapse = ", "), "\n")) - ## Encoding(res) <- "UTF-8" - ## } - res } diff --git a/inst/CITATION b/inst/CITATION old mode 100755 new mode 100644 diff --git a/inst/REFERENCES.bib b/inst/REFERENCES.bib old mode 100755 new mode 100644 index 64af182..a00b970 --- a/inst/REFERENCES.bib +++ b/inst/REFERENCES.bib @@ -30,7 +30,8 @@ @Manual{Rdevtools @Article{dummyArticle, author = {A. ZZZ}, - title = {A relation between several fundamental constants: $e^{i\pi}=-1$}, + title = {A relation between several fundamental constants: $e^{i\pi}=-1$; + Also, a test that slash is fine: Something\slash Something}, journal = {A non-existent journal with the formula $L_2$ in its name \& an ampersand which is preceded by a backslash in the bib file.}, year = {2018}, diff --git a/inst/RStudio/addins.dcf b/inst/RStudio/addins.dcf old mode 100755 new mode 100644 diff --git a/inst/examples/Rdpack-package.Rd b/inst/examples/Rdpack-package.Rd old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester.pdf b/inst/examples/RdpackTester.pdf old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/DESCRIPTION b/inst/examples/RdpackTester/DESCRIPTION old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/NAMESPACE b/inst/examples/RdpackTester/NAMESPACE old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/R/RdpackTester-internal.R b/inst/examples/RdpackTester/R/RdpackTester-internal.R old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/inst/REFERENCES.bib b/inst/examples/RdpackTester/inst/REFERENCES.bib old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/inst/auto/REFERENCES.el b/inst/examples/RdpackTester/inst/auto/REFERENCES.el old mode 100755 new mode 100644 diff --git a/inst/examples/RdpackTester/man/RdpackTester-package.Rd b/inst/examples/RdpackTester/man/RdpackTester-package.Rd old mode 100755 new mode 100644 diff --git a/inst/examples/journal_with_percents.bib b/inst/examples/journal_with_percents.bib old mode 100755 new mode 100644 diff --git a/inst/examples/reprompt.Rd b/inst/examples/reprompt.Rd old mode 100755 new mode 100644 diff --git a/inst/examples/tz.Rd b/inst/examples/tz.Rd old mode 100755 new mode 100644 diff --git a/inst/examples/url_with_percents.bib b/inst/examples/url_with_percents.bib old mode 100755 new mode 100644 diff --git a/man/macros/refmacros.Rd b/man/macros/refmacros.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/StructureClasses.Rd b/tests/testthat/StructureClasses.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/as.character.f_usage.Rd b/tests/testthat/as.character.f_usage.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/char2Rdpiece_a.RDS b/tests/testthat/char2Rdpiece_a.RDS old mode 100755 new mode 100644 diff --git a/tests/testthat/char2Rdpiece_b.RDS b/tests/testthat/char2Rdpiece_b.RDS old mode 100755 new mode 100644 diff --git a/tests/testthat/char2Rdpiece_c.RDS b/tests/testthat/char2Rdpiece_c.RDS old mode 100755 new mode 100644 diff --git a/tests/testthat/classRepresentation-class.Rd b/tests/testthat/classRepresentation-class.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/get_sig_text_f1.RDS b/tests/testthat/get_sig_text_f1.RDS old mode 100755 new mode 100644 diff --git a/tests/testthat/get_sig_text_f4.RDS b/tests/testthat/get_sig_text_f4.RDS old mode 100755 new mode 100644 diff --git a/tests/testthat/initialize-methods.Rd b/tests/testthat/initialize-methods.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/myshow-methods.Rd b/tests/testthat/myshow-methods.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/show.Rd b/tests/testthat/show.Rd old mode 100755 new mode 100644 diff --git a/tests/testthat/test-bib.R b/tests/testthat/test-bib.R old mode 100755 new mode 100644 index cf9e39b..5a6fd19 --- a/tests/testthat/test-bib.R +++ b/tests/testthat/test-bib.R @@ -8,9 +8,9 @@ test_that("bib works fine", { fn_rb <- system.file("REFERENCES.bib", package = "rbibutils") bibs_rb <- if(packageVersion("rbibutils") >= '2.1.1') readBib(fn_rb) else readBib(fn_rb, encoding = "UTF-8") - + .toRd_styled(bibs_rb, "Rdpack") - .toRd_styled(bibs_rb[["Rpackage:Rdpack"]], "Rdpack") + .toRd_styled(bibs_rb[["Rpackage:Rdpack"]], "Rdpack") .toRd_styled(bibs_rb[["Rpackage:Rdpack"]], "rbibutils", style = "JSSRd") set_Rdpack_bibstyle("JSSRd") @@ -26,7 +26,7 @@ test_that("bib works fine", { "(see also Boshnakov 2020)") expect_equal(insert_citeOnly("@see also @Rpackage:Rdpack;nobrackets", package = "rbibutils"), "see also Boshnakov 2020") - + expect_equal(insert_citeOnly("@see also @Rpackage:Rdpack among others;nobrackets", package = "rbibutils"), "see also Boshnakov 2020 among others") @@ -40,7 +40,7 @@ test_that("bib works fine", { expect_equal(insert_citeOnly( "@see also @Rpackage:rbibutils and @parseRd;textual", package = "Rdpack"), "see also Boshnakov and Putman (2020) and Murdoch (2010)") - + expect_equal(insert_citeOnly( "@see also @Rpackage:rbibutils and @parseRd, among others;textual", package = "Rdpack"), "see also Boshnakov and Putman (2020) and Murdoch (2010), among others") @@ -60,7 +60,7 @@ test_that("bib works fine", { expect_equal(insert_citeOnly( "@see also @Rpackage:rbibutils and @parseRd;nobrackets", package = "Rdpack"), "see also Boshnakov and Putman 2020 and Murdoch 2010") - + expect_equal(insert_citeOnly( "@see also @Rpackage:rbibutils and @parseRd;nobrackets", package = "Rdpack"), "see also Boshnakov and Putman 2020 and Murdoch 2010") @@ -80,21 +80,26 @@ test_that("bib works fine", { expect_error(insert_citeOnly("Rpackage:Rdpack;textual", bibpunct = c("[", "]")), "argument 'package' must be provided") - - expect_error(insert_citeOnly(c("Rpackage:Rdpack;textual", "xxxxx"), + + expect_error(insert_citeOnly(c("Rpackage:Rdpack;textual", "xxxxx"), "`keys' must be a character string")) - + insert_ref("Rpackage:Rdpack", package = "rbibutils") ## missing keys - expect_warning(insert_ref("xxx", package = "rbibutils")) + if(getRversion() <= "4.4.1") + expect_warning(insert_ref("xxx", package = "rbibutils")) + else # since R-devel c86938 the warning was changed to error + expect_error(insert_ref("xxx", package = "rbibutils")) + + expect_warning(insert_citeOnly( "@see also @Rpackage:rbibutils and @parseRd;nobrackets @kikiriki", package = "Rdpack")) ## "possibly non-existing or duplicated key(s) in bib file from package ..." - ## TODO: this tries to load package "xxx" and gives error but finishes ok and returns a + ## TODO: this tries to load package "xxx" and gives error but finishes ok and returns a ## dummy reference, as expected. - ## + ## ## Why and which instruction tries to load package "yyy"? Maybe in .Rd_styled? ## It is sufficient that the package is installed, it doesn't need to be loadable. ## expect_warning(insert_ref("xxx", package = "yyy")) # missing package @@ -103,7 +108,7 @@ test_that("bib works fine", { insert_all_ref(matrix(c("parseRd,Rpack:bibtex", "Rdpack"), ncol = 2)) insert_all_ref(matrix(c("parseRd,Rpack:bibtex", "Rdpack"), ncol = 2), empty_cited = TRUE) - + class(bibs_rb) <- c("bibentryRd", class(bibs_rb)) expect_output(print(bibs_rb)) @@ -122,7 +127,7 @@ test_that("bib works fine", { ## resaved 'dummyArticle.rds' and conditioned on R-devel r84986. ## ## Previously the rendered version of the 'note' field contained a superfluous ' .'. - ## This was fixed in R-devel r84986 (or somewhat earlier). + ## This was fixed in R-devel r84986 (or somewhat earlier). ## After the change in R-devel, we get with the old dummyArticle.rds: ## > waldo::compare(readRDS("tests/testthat/dummyArticle.rds"), ## insert_all_ref(matrix(c("dummyArticle", "Rdpack"), ncol = 2))) @@ -137,7 +142,7 @@ test_that("bib works fine", { if(is.numeric(svnrev <- R.Version()$'svn rev') && svnrev >= 84986) expect_known_value(insert_all_ref(matrix(c("dummyArticle", "Rdpack"), ncol = 2)), "dummyArticle.rds", update = FALSE) - + ## makeVignetteReference("Rdpack", 1) }) diff --git a/tests/testthat/test-char2Rdpiece.R b/tests/testthat/test-char2Rdpiece.R old mode 100755 new mode 100644 diff --git a/tests/testthat/test-reprompt.R b/tests/testthat/test-reprompt.R old mode 100755 new mode 100644