rd2_roclet: Replacement Roclet for Generating Rd Files

View source: R/roclet-rd2.R

rd2_rocletR Documentation

Replacement Roclet for Generating Rd Files

Description

This roclets acts as a drop-in replacement for [roxygen2::rd_roclet], adding some extra features such as bibliography, or inline declaration for S4 generic.

Usage

rd2_roclet()

## S3 method for class 'roclet_rd2'
roclet_process(x, blocks, env, base_path = env)

## S3 method for class 'roclet_rd2'
roclet_clean(x, base_path)

Arguments

x

A roclet object.

blocks

A list of roxy_block objects.

env

Package environment.

base_path

Path to root of source package.

Details

To use it add it needs to be declared in the roxygen options within your package's DESCRIPTION file: “' Roxygen: list(roclets = c('collate', 'namespace', 'roclets::rd2_roclet')) “'

Extra features are sometimes submitted as pull request to be incorporated into the main 'roxygen2' package. This roclet enables using them while they are being reviewed – and potentially not accepted.

Bibliography-backed references

Adds support for the following:

* tag '@bibliography' in roxygen chunks: declares external Bibtex files in which the entries parsed from '@cite', '\cite', '\citep' or '[@]' commands are copied from. This is typically a large file that contains all your references. * tag '@cite <bibtex_entries>' in roxygen chunks: to add references to the man page using their bibtex entry. * '\cite' or '\citep' in Latex markup-based documents such as vignettes or roxygen chunks * '[@<author2019>]' in markdown-based documents such as vignettes or roxygen chunks

At the end of a 'roxygenize' run, all the references found in the package man pages or vignettes are gathered and stored in file 'inst/REFERENCES.bib' in the source package directory, hence making the generation of package independent of the – large – external Bibtex file.

Examples

library(roxygen2)
text <-"
#' Title
#'
#' @bibliography a/b/c.bib
f <- function(){
}
"
parse_text(text)


renozao/roclets documentation built on Jan. 19, 2024, 2:56 p.m.