-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Labels
Description
Hi,
I am producing the Rd
file of my packages with the following :
#' @keywords internal
"_PACKAGE"
And it is fine, however I find that the text on the Description
field of my DESCRIPION is not autolinked, as it happens in the rest of my documents (maybe it is not parsing as .md
?).
Would you be open to explore this? I prepared a reprex to check how the same text is parsed diferently depending if it is placed on a regular .R file or in the DESCRIPTION file:
desc_text <- paste(
"Tools to extract information from the Intergovernmental Organizations",
"('IGO') Database , version 3, provided by the Correlates of War Project",
"<https://correlatesofwar.org/>. See also Pevehouse, J. C. et al. (2020), ",
" <doi:10.1177/0022343319881175>. Version 3 includes information from ",
" 1815 to 2014."
)
text_fun <- paste0(
"#' igoR: Intergovernmental Organizations Database
#'
#' @description ",
desc_text,
"\n#' @md\nfoo <- function() {}"
)
out <- roxygen2::roc_proc_text(
roxygen2::rd_roclet(),
text_fun
)[[1]]
# Autolinking on urls and dois
out
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{igoR: Intergovernmental Organizations Database}
#> \usage{
#> foo()
#> }
#> \description{
#> Tools to extract information from the Intergovernmental Organizations ('IGO') Database , version 3, provided by the Correlates of War Project \url{https://correlatesofwar.org/}. See also Pevehouse, J. C. et al. (2020), \url{doi:10.1177/0022343319881175}. Version 3 includes information from 1815 to 2014.
#> }
# url and doi as a link \url{ } ;)
# Now create a package and use "_PACKAGE" for documenting
temp_pkg <- file.path(tempdir(), "test")
usethis::create_package(temp_pkg, open = FALSE)
#> v Creating 'C:/Users/XXXX/AppData/Local/Temp/RtmpOUqitX/test/'
#> v Setting active project to 'C:/Users/XXXX/AppData/Local/Temp/RtmpOUqitX/test'
#> v Creating 'R/'
#> v Writing 'DESCRIPTION'
#> Package: test
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#> * First Last <first.last@example.com> [aut, cre] (YOUR-ORCID-ID)
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
#> license
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#> RoxygenNote: 7.1.2
#> v Writing 'NAMESPACE'
#> v Setting active project to '<no active project>'
desc_text <- paste(
"Tools to extract information from the Intergovernmental Organizations",
"('IGO') Database , version 3, provided by the Correlates of War Project",
"<https://correlatesofwar.org/>. See also Pevehouse, J. C. et al. (2020), ",
" <doi:10.1177/0022343319881175>. Version 3 includes information from ",
" 1815 to 2014."
)
desc::desc_set(
Description = desc_text,
file = file.path(tempdir(), "test", "DESCRIPTION")
)
#> Package: test
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#> * First Last <first.last@example.com> [aut, cre] (YOUR-ORCID-ID)
#> Description: Tools to extract information from the Intergovernmental
#> Organizations ('IGO') Database , version 3, provided by the Correlates
#> of War Project <https://correlatesofwar.org/>. See also Pevehouse, J.
#> C. et al. (2020), <doi:10.1177/0022343319881175>. Version 3 includes
#> information from 1815 to 2014.
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
#> license
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#> RoxygenNote: 7.1.2
source <- "
#' @keywords internal
\"_PACKAGE\""
write(source, file.path(temp_pkg, "R", "test-package.R"))
roxygen2::roxygenise(temp_pkg)
#> i Loading test
#> Writing test-package.Rd
readLines(con = file.path(temp_pkg, "man", "test-package.Rd"))[8:10]
#> [1] "\\description{"
#> [2] "Tools to extract information from the Intergovernmental Organizations ('IGO') Database , version 3, provided by the Correlates of War Project <https://correlatesofwar.org/>. See also Pevehouse, J. C. et al. (2020), <doi:10.1177/0022343319881175>. Version 3 includes information from 1815 to 2014."
#> [3] "}"
# No links :(
Created on 2021-10-29 by the reprex package (v2.0.1)