roxygen3 (version 0.1)

tag: [DEV] Convenience methods for manipulating tags in a block.

Description

This function is aimed primarily at developers extending this package. You shouldn't need to use it for everyday operation.

Convenience methods for manipulating tags in a block.

Usage

tag(block, tag_name, create = TRUE)
tag(block, tag_name, value) <- value
suffix(x)
prefix(x)

Arguments

block
Block object to modify
tag_name
name of the tag (as a length 1 character vector)
create
if TRUE will create a new Tag of the appropriate type if one is not present. If FALSE, it will return NULL.
value
the replacement value. If it is a character string, it will replace the text slot. If it's a suffix object, it will be added to the end of the tag's text. If it's a prefix object it will be added to the beginning of the tag's text. Otherwise, the existing tag will be replaced with the new value.
x
for suffix and prefix, text.

Examples

Run this code
block <- Block()
tag(block, "name")
tag(block, "name", create = FALSE)

tag(block, "name") <- "myname"
block
tag(block, "aliases") <- tag(block, "name")@text
block
tag(block, "aliases") <- suffix("end")
block
tag(block, "aliases") <- prefix("start")
block

Run the code above in your browser using DataLab