From d3d28078f5b3731cfc26081e816c02cb6947c181 Mon Sep 17 00:00:00 2001 From: Kelly Bodwin Date: Wed, 13 May 2020 17:19:42 -0700 Subject: [PATCH] export knit_print method properly --- NAMESPACE | 4 +++- R/with_flair.R | 11 +++++++++++ man/is.with_flair.Rd | 17 +++++++++++++++++ man/knit_print.with_flair.Rd | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 man/is.with_flair.Rd diff --git a/NAMESPACE b/NAMESPACE index ec34384..caa3c4c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,6 +6,7 @@ S3method(flair_lines,default) S3method(flair_lines,with_flair) S3method(flair_rx,default) S3method(flair_rx,with_flair) +S3method(knit_print,with_flair) S3method(mask_rx,default) S3method(mask_rx,with_flair) S3method(print,with_flair) @@ -21,7 +22,7 @@ export(flair_input_vals) export(flair_lines) export(flair_quick) export(flair_rx) -export(knit_print.with_flair) +export(is.with_flair) export(mask) export(mask_quick) export(mask_rx) @@ -42,6 +43,7 @@ export(with_flair) export(wrap_html) import(stringr) importFrom(glue,glue) +importFrom(knitr,knit_print) importFrom(magrittr,"%>%") importFrom(purrr,map) importFrom(purrr,map2) diff --git a/R/with_flair.R b/R/with_flair.R index ee43ed8..8d1fdff 100644 --- a/R/with_flair.R +++ b/R/with_flair.R @@ -21,7 +21,9 @@ with_flair <- function(x) { #' @return "as-is" html output, to be rendered when knitted #' #' @importFrom purrr map +#' @importFrom knitr knit_print #' +#' @method knit_print with_flair #' @export knit_print.with_flair <- function(x, ...) { @@ -161,3 +163,12 @@ print.with_flair <- function(x, ...) { } + +#' Method check +#' +#' @param x An object +#' +#' @return Whether the object is a \code{with_flair} class object. +#' +#' @export +is.with_flair <- function(x) inherits(x, "with_flair") diff --git a/man/is.with_flair.Rd b/man/is.with_flair.Rd new file mode 100644 index 0000000..cae1591 --- /dev/null +++ b/man/is.with_flair.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/with_flair.R +\name{is.with_flair} +\alias{is.with_flair} +\title{Method check} +\usage{ +is.with_flair(x) +} +\arguments{ +\item{x}{An object} +} +\value{ +Whether the object is a \code{with_flair} class object. +} +\description{ +Method check +} diff --git a/man/knit_print.with_flair.Rd b/man/knit_print.with_flair.Rd index 6ee4cc8..d1f8af8 100644 --- a/man/knit_print.with_flair.Rd +++ b/man/knit_print.with_flair.Rd @@ -4,7 +4,7 @@ \alias{knit_print.with_flair} \title{S3 method for knitting a \code{with_flair} object} \usage{ -knit_print.with_flair(x, ...) +\method{knit_print}{with_flair}(x, ...) } \arguments{ \item{x}{A \code{with_flair} object.}