Collect aliases or other metadata from an Rd object

Description

Collect aliases or other metadata from an Rd object

Usage

1
2
3

Arguments

rdo

an Rd object

sec

the kind of metadata to collect, a character string, such as "alias" and "keyword".

Details

Rdo_collect_aliases finds all aliases in rdo and returns them as a named character vector. The name of an alias is usually the empty string, "", but it may also be "windows" or "unix" if the alias is wrapped in a #ifdef directive with the corresponding first argument.

Rdo_collect_metadata is a generalisation of the above which collect the metadata from sections sec, where sec is the name of a section without the leading backslash.

sec is assumed to be a section containing a single word, such as "keyword", "alias", "name".

Value

a named character vector, as described in details.

Author(s)

Georgi N. Boshnakov

See Also

tools:::.Rd_get_metadata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# this needs "timezones.Rd".

infile <- file.path(R.home(), "src/library/base/man/timezones.Rd")
rd <- parse_Rd(infile)

# The functions described here handle also "ifdef" and similar
# directives. This contains an element windows = "TZDIR"
Rdo_collect_aliases(rd)

# In contrast, the following do  not find "TZDIR"
sapply(rd[which(tools:::RdTags(rd)=="\alias")], as.character)
tools:::.Rd_get_metadata(rd, "alias")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.