Rdpack (version 0.4-20)

Rdo_sections: Locate the sections in Rd objects

Description

Locate the Rd sections in an Rd object and return a list of their positions and names.

Usage

Rdo_sections(rdo)
Rdo_locate_core_section(rdo, sec)

Arguments

rdo
an Rd object.
sec
the name of a section, a character string.

Value

A list giving the positions and titles of the sections in rdo as described in 'Details'. The format isessentially that of Rdo_locate, the difference being that field "value" from that function is renamed to "title" here.

Details

Rdo_sections locates all sections allowed at the top level in an Rd object. This includes the predefined sections and the user defined sections. Sections wrapped in #ifdef directives are also found.

Rdo_sections returns a list with one entry for each section in rdo. This entry is a list with components "pos" and "title" giving the position (suitable for use in "[[") and the title of the section. For user defined sections the actual name is returned, not "section".

The names of the sections are returned as single strings without attributes. The titles of predefined sections are single words but user defined sections may have longer titles and sometimes contain basic markup.

Rdo_locate_core_section works similarly but returns only the results for section sec. Currently it simply calls Rdo_sections and returns only the results for sec.

Note that for consistency Rdo_locate_core_section does not attempt to simplify the result in the common case when there is only one instance of the requested section---it is put in a list of length one. todo: maybe create a convenience function for this case or (better) introduce an argument to request dropping the outer list?

See Also

Rdo_locate