-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathroxy_block.Rd
63 lines (52 loc) · 1.62 KB
/
roxy_block.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/block.R
\name{roxy_block}
\alias{roxy_block}
\alias{block_has_tags}
\alias{block_get_tags}
\alias{block_get_tag}
\alias{block_get_tag_value}
\title{Blocks}
\usage{
roxy_block(tags, file, line, call, object = NULL)
block_has_tags(block, tags)
block_get_tags(block, tags)
block_get_tag(block, tag)
block_get_tag_value(block, tag)
}
\arguments{
\item{tags}{A list of \link{roxy_tag}s.}
\item{file, line}{Location of the \code{call} (i.e. the line after the last
line of the block).}
\item{call}{Expression associated with block.}
\item{object}{Optionally, the object associated with the block, found
by inspecting/evaluating \code{call}.}
\item{block}{A \code{roxy_block} to manipulate.}
\item{tag}{A single tag name.}
}
\description{
A \code{roxy_block} represents a single roxygen2 block.
The \verb{block_*} functions provide a few helpers for common operations:
\itemize{
\item \code{block_has_tags(blocks, tags)}: does \code{block} contain any of these \code{tags}?
\item \code{block_get_tags(block, tags)}: get all instances of \code{tags}
\item \code{block_get_tag(block, tag)}: get single tag. Returns \code{NULL} if 0,
throws warning if more than 1.
\item \code{block_get_tag_value(block, tag)}: gets \code{val} field from single tag.
}
}
\examples{
# The easiest way to see the structure of a roxy_block is to create one
# using parse_text:
text <- "
#' This is a title
#'
#' @param x,y A number
#' @export
f <- function(x, y) x + y
"
# parse_text() returns a list of blocks, so I extract the first
block <- parse_text(text)[[1]]
block
}
\keyword{internal}