diff --git a/DESCRIPTION b/DESCRIPTION index fe45fd3..0f6ee60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,4 +25,4 @@ VignetteBuilder: knitr Encoding: UTF-8 URL: https://github.com/Bioconductor/BiocStyle BugReports: https://github.com/Bioconductor/BiocStyle/issues -RoxygenNote: 6.1.0 +RoxygenNote: 7.3.2 diff --git a/R/markdown.R b/R/markdown.R index 81a63d4..0c12361 100644 --- a/R/markdown.R +++ b/R/markdown.R @@ -120,6 +120,9 @@ markdown <- #' html or pdf extension, e.g., "work-0-intro.html". #' @param label character(1) label used to identify the package or #' vignette. If \code{NULL}, defaults to \code{pkg}. +#' @param versioned logical(1), determines the creation of links to Bioconductor +#' packages including the version number (default) or not, using the general +#' "short form" of the link. Applies to \code{Biocpkg} and \code{Biocbook}. #' @param repo Repository address in the format username/repo[/subdir] #' @return Markdown-formatted character vector containing a #' hyperlinked package name. If \code{vignette != NULL}, the @@ -158,8 +161,13 @@ NULL #' @rdname macros #' @importFrom BiocManager version #' @export -Biocpkg <- function(pkg, vignette = NULL, label = NULL) { - url <- file.path("https://bioconductor.org/packages", version(), pkg) +Biocpkg <- function(pkg, vignette = NULL, label = NULL, versioned = TRUE) { + url <- ifelse( + versioned, + file.path("https://bioconductor.org/packages", version(), pkg), + file.path("https://bioconductor.org/packages", pkg) + ) + if (!is.null(vignette)) { url <- file.path(url, "vignettes", vignette) } @@ -176,8 +184,12 @@ labelled_link <- function(pkg, label, url) { #' @rdname macros #' @export -Biocbook <- function(pkg, label = NULL) { - url <- file.path("http://bioconductor.org/books", version(), pkg) +Biocbook <- function(pkg, label = NULL, versioned = TRUE) { + url <- ifelse( + versioned, + file.path("https://bioconductor.org/books", version(), pkg), + file.path("https://bioconductor.org/books", pkg) + ) labelled_link(pkg, label, url) } diff --git a/man/html_document.Rd b/man/html_document.Rd index 51b18cb..f845850 100644 --- a/man/html_document.Rd +++ b/man/html_document.Rd @@ -4,9 +4,17 @@ \alias{html_document} \title{Use Bioconductor style to format R Markdown HTML output} \usage{ -html_document(toc = TRUE, number_sections = TRUE, fig_width = NA, - fig_height = NA, self_contained = TRUE, css = NULL, - pandoc_args = NULL, ..., titlecaps = TRUE) +html_document( + toc = TRUE, + number_sections = TRUE, + fig_width = NA, + fig_height = NA, + self_contained = TRUE, + css = NULL, + pandoc_args = NULL, + ..., + titlecaps = TRUE +) } \arguments{ \item{toc}{logical(1), \code{TRUE} to include a table of contents in the diff --git a/man/latex.Rd b/man/latex.Rd index 9f890ee..81cf18b 100644 --- a/man/latex.Rd +++ b/man/latex.Rd @@ -4,8 +4,15 @@ \alias{latex} \title{Use Bioconductor style to format LaTeX vignettes} \usage{ -latex(..., width, titlecaps = TRUE, short.fignames = FALSE, fig.path, - use.unsrturl = TRUE, relative.path = FALSE) +latex( + ..., + width, + titlecaps = TRUE, + short.fignames = FALSE, + fig.path, + use.unsrturl = TRUE, + relative.path = FALSE +) } \arguments{ \item{\dots}{Additional arguments, passed to \code{\link{options}}.} diff --git a/man/macros.Rd b/man/macros.Rd index 9e534f6..29d11c7 100644 --- a/man/macros.Rd +++ b/man/macros.Rd @@ -11,9 +11,9 @@ \alias{Githubpkg} \title{Link to packages on Bioconductor, CRAN and GitHub} \usage{ -Biocpkg(pkg, vignette = NULL, label = NULL) +Biocpkg(pkg, vignette = NULL, label = NULL, versioned = TRUE) -Biocbook(pkg, label = NULL) +Biocbook(pkg, label = NULL, versioned = TRUE) Biocannopkg(pkg) @@ -34,6 +34,10 @@ html or pdf extension, e.g., "work-0-intro.html".} \item{label}{character(1) label used to identify the package or vignette. If \code{NULL}, defaults to \code{pkg}.} +\item{versioned}{logical(1), determines the creation of links to Bioconductor +packages including the version number (default) or not, using the general +"short form" of the link. Applies to \code{Biocpkg} and \code{Biocbook}.} + \item{repo}{Repository address in the format username/repo[/subdir]} } \value{ diff --git a/man/pdf_document.Rd b/man/pdf_document.Rd index bf91167..8476ddd 100644 --- a/man/pdf_document.Rd +++ b/man/pdf_document.Rd @@ -4,9 +4,18 @@ \alias{pdf_document} \title{Use Bioconductor style to format R Markdown PDF output} \usage{ -pdf_document(toc = TRUE, number_sections = TRUE, fig_width = NA, - fig_height = NA, includes = NULL, ..., titlecaps = TRUE, - toc_newpage = FALSE, use_unsrturl = TRUE, relative_path = FALSE) +pdf_document( + toc = TRUE, + number_sections = TRUE, + fig_width = NA, + fig_height = NA, + includes = NULL, + ..., + titlecaps = TRUE, + toc_newpage = FALSE, + use_unsrturl = TRUE, + relative_path = FALSE +) } \arguments{ \item{toc}{logical(1), \code{TRUE} to include a table of contents in the