generateMarkup: Generate R documentation atomic piece

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/generateMarkup.R

Description

Generate R documentation atomic pieces, managing various parameters to fulfil R documentation requirements.

Usage

1
2
3
4
5
generateMarkup(content_s, keyword_s_1 = NA_character_,
               content2_s = NA_character_,
               inline_b_1 = TRUE, useSpace_b_1 = FALSE,
               escapeBraces_b_1 = FALSE,
               content3_s = NA_character_)

Arguments

content_s

a vector of strings, that is the content to consider

keyword_s_1

a R documentation keyword. See rdocKeywords.

content2_s

a vector of strings that is a second content, useful with some keywords that require two members

inline_b_1

a single boolean expressing if the result should be printed on a single line or not?

useSpace_b_1

a single boolean asking for space insertion. When dealing with documentation keywords that requires two members, some may require a space in between to work properly. This parameters allows you to ask for this.

escapeBraces_b_1

when TRUE, braces characters are escaped

content3_s

a vector of strings that is a third content, useful with some keywords that require three members

Details

Very convenient function, to customize your R documentation output.

Might be used programmatically to generate pieces or full documentation.

Tested thoroughly with zero, one, two and three contents to cover all the markups of R documentation.

See examples below.

Value

A single string, containing one or several lines of text. Provided content is processed by function escapeContent.

Author(s)

Fabien Gelineau <neonira@gmail.com>

Maintainer: Fabien Gelineau <neonira@gmail.com>

References

Refer to Writing R extensions to know more about R documentation requirements.

See Also

Refer to escapeContent.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 0. zero content example
print(generateMarkup(keyword = 'R'))
# "\\R"

# 1. one content example
print(generateMarkup('a title', 'title'))
# "\\title{a title}"

# 2. Two contents examples
print(generateMarkup('https://neonira.github.io/offensiveProgrammingBook/',
'href', 'Offensive Programming Book'))
# "\\href{https://neonira.github.io/offensiveProgrammingBook/}{Offensive Programming Book}"

print(generateMarkup('a', 'item', 'description of a', useSpace_b_1 = TRUE))
# "\\item{a} {description of a}"

print(generateMarkup('a', 'item', 'description of a', useSpace_b_1 = FALSE))
"\\item{a}{description of a}"

# 3. Three contents example
print(generateMarkup('content_1', 'ifelse', 'content_2', content3_s = 'content_3'))
# "\\ifelse{content_1}{content_2}{content_3}"

wyz.code.rdoc documentation built on Oct. 6, 2021, 9:07 a.m.