From f7c6e459f8724b8fb6e233d6bb36537e16cf4b43 Mon Sep 17 00:00:00 2001 From: Carson Date: Sat, 13 Jun 2020 11:53:54 -0500 Subject: [PATCH] Use roxygen2 markdown links to fix new r-devel warning 'Non-file package-anchored link(s) in documentation object' Note this leverages r-lib/roxygen2@fix/link-to-file --- DESCRIPTION | 2 +- R/images.R | 60 ++++++++++++++++++++--------------------- R/tags.R | 2 +- man/as.tags.Rd | 2 +- man/capturePlot.Rd | 10 +++---- man/defaultPngDevice.Rd | 2 +- man/plotTag.Rd | 23 +++++++--------- 7 files changed, 47 insertions(+), 54 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 53856a90..0c4f14c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,7 +29,7 @@ Enhances: knitr License: GPL (>= 2) URL: https://github.com/rstudio/htmltools BugReports: https://github.com/rstudio/htmltools/issues -RoxygenNote: 7.1.0 +RoxygenNote: 7.1.0.9000 Encoding: UTF-8 Collate: 'colors.R' diff --git a/R/images.R b/R/images.R index 5cdf92ce..21ddf0a9 100644 --- a/R/images.R +++ b/R/images.R @@ -5,20 +5,19 @@ #' #' @param expr A plotting expression that generates a plot (or yields an object #' that generates a plot when printed, like a ggplot2). We evaluate this -#' expression after activating the graphics device (\code{device}). -#' @param filename The output filename. By default, a temp file with \code{.png} +#' expression after activating the graphics device (`device`). +#' @param filename The output filename. By default, a temp file with `.png` #' extension will be used; you should provide a filename with a different #' extension if you provide a non-PNG graphics device function. #' @param device A graphics device function; by default, this will be either -#' \code{\link[grDevices:png]{grDevices::png()}}, -#' \code{\link[ragg:agg_png]{ragg::agg_png()}}, or -#' \code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}}, depending on -#' your system and configuration. See \code{\link{defaultPngDevice}}. -#' @param width,height,res,... Additional arguments to the \code{device} function. +#' [grDevices::png()], [ragg::agg_png()], or [Cairo::CairoPNG()], depending on +#' your system and configuration. See [defaultPngDevice()]. +#' @param width,height,res,... Additional arguments to the `device` function. #' -#' @seealso \code{\link{plotTag}} saves plots as a self-contained \code{} +#' @seealso [plotTag()] saves plots as a self-contained `` #' tag. #' +#' @md #' @examples #' #' # Default settings @@ -98,7 +97,7 @@ capturePlot <- function(expr, filename = tempfile(fileext = ".png"), }) } -#' Capture a plot as a self-contained \code{} tag +#' Capture a plot as a self-contained `` tag #' #' @param expr A plotting expression that generates a plot (or yields an object #' that generates a plot when printed, like a ggplot2). @@ -106,35 +105,33 @@ capturePlot <- function(expr, filename = tempfile(fileext = ".png"), #' of the image. This is used by accessibility tools, such as screen readers #' for vision impaired users. #' @param device A graphics device function; by default, this will be either -#' \code{\link[grDevices:png]{grDevices::png()}}, -#' \code{\link[ragg:agg_png]{ragg::agg_png()}}, or -#' \code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}}, depending on your system -#' and configuration. See \code{\link{defaultPngDevice}}. +#' [grDevices::png()], [ragg::agg_png()], or [Cairo::CairoPNG()], depending on +#' your system and configuration. See [defaultPngDevice()]. #' @param width,height The width/height that the generated tag should be #' displayed at, in logical (browser) pixels. #' @param pixelratio Indicates the ratio between physical and logical units of -#' length. For PNGs that may be displayed on high-DPI screens, use \code{2}; +#' length. For PNGs that may be displayed on high-DPI screens, use `2`; #' for graphics devices that express width/height in inches (like -#' \code{\link[grDevices:svg]{grDevices::svg()}}), try \code{1/72} or -#' \code{1/96}. -#' @param mimeType The MIME type associated with the \code{device}. Examples are -#' \code{image/png}, \code{image/tiff}, \code{image/svg+xml}. +#' [grDevices::svg()], try `1/72` or `1/96`. +#' @param mimeType The MIME type associated with the `device`. Examples are +#' `image/png`, `image/tiff`, `image/svg+xml`. #' @param deviceArgs A list of additional arguments that should be included when -#' the \code{device} function is invoked. +#' the `device` function is invoked. #' @param attribs A list of additional attributes that should be included on the -#' generated \code{} (e.g. \code{id}, \code{class}). -#' @param suppressSize By default, \code{plotTag} will include a \code{style} -#' attribute with \code{width} and \code{height} properties specified in +#' generated `` (e.g. `id`, `class`). +#' @param suppressSize By default, `plotTag` will include a `style` +#' attribute with `width` and `height` properties specified in #' pixels. If you'd rather specify the image size using other methods (like #' responsive CSS rules) you can use this argument to suppress width -#' (\code{"x"}), height (\code{"y"}), or both (\code{"xy"}) properties. +#' (`"x"`), height (`"y"`), or both (`"xy"`) properties. #' -#' @return A \code{\link{browsable}} HTML \code{} tag object. Print it at -#' the console to preview, or call \code{\link{as.character}} on it to view the HTML +#' @return A [browsable()] HTML `` tag object. Print it at +#' the console to preview, or call [as.character()] on it to view the HTML #' source. #' -#' @seealso \code{\link{capturePlot}} saves plots as an image file. +#' @seealso [capturePlot()] saves plots as an image file. #' +#' @md #' @examples #' #' img <- plotTag({ @@ -183,15 +180,16 @@ plotTag <- function(expr, alt, device = defaultPngDevice(), width = 400, height #' Determine the best PNG device for your system #' #' Returns the best PNG-based graphics device for your system, in the opinion of -#' the \code{htmltools} maintainers. On Mac, -#' \code{\link[grDevices:png]{grDevices::png()}} is used; on all other -#' platforms, either \code{\link[ragg:agg_png]{ragg::agg_png()}} or -#' \code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}} are used if their packages -#' are installed. Otherwise, \code{\link[grDevices:png]{grDevices::png()}} is +#' the `htmltools` maintainers. On Mac, +#' [grDevices::png()] is used; on all other +#' platforms, either [ragg::agg_png()] or +#' [Cairo::CairoPNG()] are used if their packages +#' are installed. Otherwise, [grDevices::png()] is #' used. #' #' @return A graphics device function. #' +#' @md #' @export defaultPngDevice <- function() { if (capabilities("aqua")) { diff --git a/R/tags.R b/R/tags.R index 9e18e25b..984f9f87 100644 --- a/R/tags.R +++ b/R/tags.R @@ -895,7 +895,7 @@ flattenTags <- function(x) { #' #' An S3 method for converting arbitrary values to a value that can be used as #' the child of a tag or \code{tagList}. The default implementation simply calls -#' \code{\link[base]{as.character}}. +#' \code{\link{as.character}}. #' #' @param x Object to be converted. #' @param ... Any additional parameters. diff --git a/man/as.tags.Rd b/man/as.tags.Rd index 49ff1251..819d06eb 100644 --- a/man/as.tags.Rd +++ b/man/as.tags.Rd @@ -14,5 +14,5 @@ as.tags(x, ...) \description{ An S3 method for converting arbitrary values to a value that can be used as the child of a tag or \code{tagList}. The default implementation simply calls -\code{\link[base]{as.character}}. +\code{\link{as.character}}. } diff --git a/man/capturePlot.Rd b/man/capturePlot.Rd index d231745e..98b8f0cc 100644 --- a/man/capturePlot.Rd +++ b/man/capturePlot.Rd @@ -24,10 +24,8 @@ extension will be used; you should provide a filename with a different extension if you provide a non-PNG graphics device function.} \item{device}{A graphics device function; by default, this will be either -\code{\link[grDevices:png]{grDevices::png()}}, -\code{\link[ragg:agg_png]{ragg::agg_png()}}, or -\code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}}, depending on -your system and configuration. See \code{\link{defaultPngDevice}}.} +\code{\link[grDevices:png]{grDevices::png()}}, \code{\link[ragg:agg_png]{ragg::agg_png()}}, or \code{\link[Cairo:Cairo]{Cairo::CairoPNG()}}, depending on +your system and configuration. See \code{\link[=defaultPngDevice]{defaultPngDevice()}}.} \item{width, height, res, ...}{Additional arguments to the \code{device} function.} } @@ -64,6 +62,6 @@ unlink(svgpath) } \seealso{ -\code{\link{plotTag}} saves plots as a self-contained \code{} - tag. +\code{\link[=plotTag]{plotTag()}} saves plots as a self-contained \verb{} +tag. } diff --git a/man/defaultPngDevice.Rd b/man/defaultPngDevice.Rd index 4f6c2139..e6365a64 100644 --- a/man/defaultPngDevice.Rd +++ b/man/defaultPngDevice.Rd @@ -14,7 +14,7 @@ Returns the best PNG-based graphics device for your system, in the opinion of the \code{htmltools} maintainers. On Mac, \code{\link[grDevices:png]{grDevices::png()}} is used; on all other platforms, either \code{\link[ragg:agg_png]{ragg::agg_png()}} or -\code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}} are used if their packages +\code{\link[Cairo:Cairo]{Cairo::CairoPNG()}} are used if their packages are installed. Otherwise, \code{\link[grDevices:png]{grDevices::png()}} is used. } diff --git a/man/plotTag.Rd b/man/plotTag.Rd index 0d153caf..16d606b9 100644 --- a/man/plotTag.Rd +++ b/man/plotTag.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/images.R \name{plotTag} \alias{plotTag} -\title{Capture a plot as a self-contained \code{} tag} +\title{Capture a plot as a self-contained \verb{} tag} \usage{ plotTag( expr, @@ -26,10 +26,8 @@ of the image. This is used by accessibility tools, such as screen readers for vision impaired users.} \item{device}{A graphics device function; by default, this will be either -\code{\link[grDevices:png]{grDevices::png()}}, -\code{\link[ragg:agg_png]{ragg::agg_png()}}, or -\code{\link[Cairo:CairoPNG]{Cairo::CairoPNG()}}, depending on your system -and configuration. See \code{\link{defaultPngDevice}}.} +\code{\link[grDevices:png]{grDevices::png()}}, \code{\link[ragg:agg_png]{ragg::agg_png()}}, or \code{\link[Cairo:Cairo]{Cairo::CairoPNG()}}, depending on +your system and configuration. See \code{\link[=defaultPngDevice]{defaultPngDevice()}}.} \item{width, height}{The width/height that the generated tag should be displayed at, in logical (browser) pixels.} @@ -37,8 +35,7 @@ displayed at, in logical (browser) pixels.} \item{pixelratio}{Indicates the ratio between physical and logical units of length. For PNGs that may be displayed on high-DPI screens, use \code{2}; for graphics devices that express width/height in inches (like -\code{\link[grDevices:svg]{grDevices::svg()}}), try \code{1/72} or -\code{1/96}.} +\code{\link[grDevices:cairo]{grDevices::svg()}}, try \code{1/72} or \code{1/96}.} \item{mimeType}{The MIME type associated with the \code{device}. Examples are \code{image/png}, \code{image/tiff}, \code{image/svg+xml}.} @@ -47,7 +44,7 @@ for graphics devices that express width/height in inches (like the \code{device} function is invoked.} \item{attribs}{A list of additional attributes that should be included on the -generated \code{} (e.g. \code{id}, \code{class}).} +generated \verb{} (e.g. \code{id}, \code{class}).} \item{suppressSize}{By default, \code{plotTag} will include a \code{style} attribute with \code{width} and \code{height} properties specified in @@ -56,12 +53,12 @@ responsive CSS rules) you can use this argument to suppress width (\code{"x"}), height (\code{"y"}), or both (\code{"xy"}) properties.} } \value{ -A \code{\link{browsable}} HTML \code{} tag object. Print it at - the console to preview, or call \code{\link{as.character}} on it to view the HTML - source. +A \code{\link[=browsable]{browsable()}} HTML \verb{} tag object. Print it at +the console to preview, or call \code{\link[=as.character]{as.character()}} on it to view the HTML +source. } \description{ -Capture a plot as a self-contained \code{} tag +Capture a plot as a self-contained \verb{} tag } \examples{ @@ -80,5 +77,5 @@ if (interactive()) svg } \seealso{ -\code{\link{capturePlot}} saves plots as an image file. +\code{\link[=capturePlot]{capturePlot()}} saves plots as an image file. }