Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 16 additions & 4 deletions R/markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}

Expand Down
14 changes: 11 additions & 3 deletions man/html_document.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions man/latex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions man/macros.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/pdf_document.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.