Skip to content

Commit e147412

Browse files
committed
Deploying to gh-pages from @ 0ccb95e 🚀
1 parent f051f02 commit e147412

81 files changed

Lines changed: 265 additions & 98 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dev/CODE_OF_CONDUCT.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/LICENSE-text.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/LICENSE.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/SUPPORT.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/SUPPORT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ two general techniques that can help:
2323
and text snippet:
2424

2525
``` r
26+
2627
library(roxygen2)
2728
roc_proc_text(rd_roclet(), "
2829
#' Title

dev/articles/extending.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/articles/extending.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ can use its two extension points:
1818
to compute anything you want or produce any artefact you can imagine.
1919

2020
``` r
21+
2122
library(roxygen2)
2223
```
2324

@@ -80,6 +81,7 @@ You *can* construct tag objects by hand with
8081
[`roxy_tag()`](https://roxygen2.r-lib.org/dev/reference/roxy_tag.md):
8182

8283
``` r
84+
8385
roxy_tag("name", "Hadley")
8486
#> [????:???] @name 'Hadley' {unparsed}
8587
str(roxy_tag("name", "Hadley"))
@@ -113,6 +115,7 @@ is to generate one by parsing a roxygen block with
113115
[`parse_text()`](https://roxygen2.r-lib.org/dev/reference/parse_package.md):
114116

115117
``` r
118+
116119
text <- "
117120
#' This is a title
118121
#'
@@ -174,6 +177,7 @@ create a bulleted list of tips about how to use a function. The idea is
174177
to take something like this:
175178

176179
``` r
180+
177181
#' @tip The mean of a logical vector is the proportion of `TRUE` values.
178182
#' @tip You can compute means of dates and date-times!
179183
```
@@ -199,6 +203,7 @@ want to process the text using Markdown so we can just use
199203
[`tag_markdown()`](https://roxygen2.r-lib.org/dev/reference/tag_parsers.md):
200204

201205
``` r
206+
202207
roxy_tag_parse.roxy_tag_tip <- function(x) {
203208
tag_markdown(x)
204209
}
@@ -211,6 +216,7 @@ We can check this works by using
211216
[`parse_text()`](https://roxygen2.r-lib.org/dev/reference/parse_package.md):
212217

213218
``` r
219+
214220
text <- "
215221
#' Title
216222
#'
@@ -259,6 +265,7 @@ We’re going to create a new custom section called `tip`. It will contain
259265
a character vector of tips:
260266

261267
``` r
268+
262269
roxy_tag_rd.roxy_tag_tip <- function(x, base_path, env) {
263270
rd_section("tip", x$val)
264271
}
@@ -284,6 +291,7 @@ We then need to define a
284291
object into text for the `.Rd` file:
285292

286293
``` r
294+
287295
format.rd_section_tip <- function(x, ...) {
288296
paste0(
289297
"\\section{Tips and tricks}{\n",
@@ -298,6 +306,7 @@ format.rd_section_tip <- function(x, ...) {
298306
We can now try this out with `roclet_text()`:
299307

300308
``` r
309+
301310
topic <- roc_proc_text(rd_roclet(), text)[[1]]
302311
topic$get_section("tip")
303312
#> \section{Tips and tricks}{
@@ -339,7 +348,7 @@ for more details.
339348
Creating a new roclet is usually a two part process. First, you define
340349
new tags that your roclet will work with, unless your roclet only needs
341350
information from existing tags, or only needs the path to the package
342-
source[¹](#fn1). Second, you define a roclet that tells
351+
source[^1]. Second, you define a roclet that tells
343352
[`roxygenize()`](https://roxygen2.r-lib.org/dev/reference/roxygenize.md)
344353
what to compute and produce based on this information.
345354

@@ -350,19 +359,22 @@ remember what you’re planning to work on in the future by displaying
350359
notes when you document your package. We choose this syntax for `@memo`:
351360

352361
``` r
362+
353363
#' @memo [Headline] Description
354364
```
355365

356366
For example:
357367

358368
``` r
369+
359370
#' @memo [EFFICIENCY] Currently brute-force; find better algorithm.
360371
```
361372

362373
As above, we first define a parse method. This time we use custom format
363374
based on a regular expression:
364375

365376
``` r
377+
366378
roxy_tag_parse.roxy_tag_memo <- function(x) {
367379
if (!grepl("^\\[.*\\].*$", x$raw)) {
368380
roxy_tag_warning(x, "Invalid memo format")
@@ -383,6 +395,7 @@ Then we check it works with
383395
[`parse_text()`](https://roxygen2.r-lib.org/dev/reference/parse_package.md):
384396

385397
``` r
398+
386399
text <- "
387400
#' @memo [TBI] Remember to implement this!
388401
#' @memo [API] Check best API
@@ -417,7 +430,7 @@ str(block$tags[[1]])
417430
```
418431

419432
We don’t need a format method because our tag won’t be used to produce
420-
Rd sections[²](#fn2).
433+
Rd sections[^2].
421434

422435
### The roclet
423436

@@ -426,6 +439,7 @@ Next, we create a constructor for the roclet, which uses
426439
`memo` roclet doesn’t have any options so this is very simple:
427440

428441
``` r
442+
429443
memo_roclet <- function() {
430444
roclet("memo")
431445
}
@@ -447,6 +461,7 @@ For this roclet, we’ll have
447461
collect all the memo tags into a named list:
448462

449463
``` r
464+
450465
roclet_process.roclet_memo <- function(x, blocks, env, base_path) {
451466
results <- list()
452467

@@ -468,6 +483,7 @@ And then have
468483
print them to the screen:
469484

470485
``` r
486+
471487
roclet_output.roclet_memo <- function(x, results, base_path, ...) {
472488
for (header in names(results)) {
473489
messages <- results[[header]]
@@ -483,6 +499,7 @@ Then you can test if it works by using
483499
[`roc_proc_text()`](https://roxygen2.r-lib.org/dev/reference/roc_proc_text.md):
484500

485501
``` r
502+
486503
results <- roc_proc_text(
487504
memo_roclet(),
488505
"
@@ -511,6 +528,7 @@ roclet_output(memo_roclet(), results)
511528
To use a roclet when developing a package, call
512529

513530
``` r
531+
514532
roxygen2::roxygenize(roclets = "yourPackage::roclet")
515533
```
516534

@@ -534,6 +552,7 @@ package, which doesn’t correspond precisely to any field in the
534552
and hence put it in the `Suggests:` field:
535553

536554
``` r
555+
537556
usethis::use_package("yourPackage", type = "Suggests")
538557
```
539558

@@ -555,17 +574,15 @@ parsing features from roxygen2, and does not use
555574
[`roxygenize()`](https://roxygen2.r-lib.org/dev/reference/roxygenize.md)
556575
at all.
557576

558-
------------------------------------------------------------------------
559-
560-
1. For example, the no-longer recommended
577+
[^1]: For example, the no-longer recommended
561578
[`vignette_roclet()`](https://roxygen2.r-lib.org/dev/reference/vignette_roclet.md)
562579
only needs the path to the package source as input; it does not use
563580
information from the tag parsing step. Or the {roxylint} package
564581
only uses existing tags; its job is to warn you about suboptimal
565582
roxygen2 style.
566583

567-
2. Some tags in roxygen2 itself, like `@importFrom`, are not meant for
568-
the
584+
[^2]: Some tags in roxygen2 itself, like `@importFrom`, are not meant
585+
for the
569586
\[[`rd_roclet()`](https://roxygen2.r-lib.org/dev/reference/rd_roclet.md)\]
570587
(`@importFrom` is meant for the
571588
[`namespace_roclet()`](https://roxygen2.r-lib.org/dev/reference/namespace_roclet.md)).

dev/articles/index-crossref.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/articles/index-crossref.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ web (using a url) or to related functions (with a function link like
1111
this might look like:
1212

1313
``` r
14+
1415
#' @seealso [prod()] for products, [cumsum()] for cumulative sums, and
1516
#' [colSums()]/[rowSums()] marginal sums over high-dimensional arrays.
1617
```
@@ -29,6 +30,7 @@ If you want to override the default title, you can provide an
2930
`rd_family_title` element in a list stored in `man/roxygen/meta.R`:
3031

3132
``` r
33+
3234
list(
3335
rd_family_title = list(aggregations = "Aggregation functions")
3436
)
@@ -84,6 +86,7 @@ specifying the “true” source of the documentation, and will substitute
8486
the default list of source files. Use one tag per source file:
8587

8688
``` r
89+
8790
#' @backref src/file.cpp
8891
#' @backref src/file.h
8992
```

dev/articles/index.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)