Skip to content

Commit

Permalink
Fixing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
osheen1 committed Sep 22, 2022
1 parent c00c6ca commit 14e323f
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 5 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ Suggests:
rmarkdown,
testthat,
UNF
Remotes: leeper/UNF
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
RoxygenNote: 7.2.1
10 changes: 8 additions & 2 deletions R/name_chunks.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' before pushing them to your code base. Such automatic
#' chunk labelling is best paired with version control.
#'
#' @returns Always returns TRUE invisibly. Called for side effects.
#'
#' @template path
#' @template unname
#'
Expand All @@ -30,7 +32,7 @@ name_chunks <- function(path, unname = FALSE){

# early exit if no chunk
if(is.null(chunk_headers_info)){
return(invisible("TRUE"))
return(invisible(TRUE))
}

# check if a force-unname should be done
Expand Down Expand Up @@ -91,13 +93,15 @@ Maybe namer::unname_chunks before running name_chunks.")
# save file
writeLines(lines, path)
}
return(invisible("TRUE"))
return(invisible(TRUE))
}

#' @title Name chunks of all Rmds in a dir
#'
#' @description Name unnamed chunks in a dir using the filenames with extension stripped as basis.
#'
#' @returns Always returns TRUE invisibly. Called for side effects.
#'
#' @inherit name_chunks details
#'
#' @template dir
Expand Down Expand Up @@ -132,6 +136,8 @@ name_dir_chunks <- function(dir, unname = FALSE){

rmds <- fs::dir_ls(dir, regexp = "*.[Rr]md")
purrr::walk(rmds, chatty_name_chunks)

return(invisible(TRUE))
}

chatty_name_chunks <- function(path){
Expand Down
7 changes: 7 additions & 0 deletions R/unname_chunks.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#' or alternatively only unname the chunknames with a given prefix.
#' In both cases, the chunk name "setup" is preserved, that chunk is never unnamed.
#'
#' @returns Always returns TRUE invisibly. Called for side effects.
#'
#' @inherit name_chunks details
#'
#' @template path
Expand Down Expand Up @@ -60,12 +62,16 @@ unname_chunks <- function(path, chunk_name_prefix = NULL) {

# save file
writeLines(lines, path)

return(invisible(TRUE))
}

#' @title Unname chunks of all Rmds in a dir
#'
#' @description Name unnamed chunks in a dir using the filenames with extension stripped as basis.
#'
#' @returns Always returns TRUE invisibly. Called for side effects.
#'
#' @inherit name_chunks details
#'
#' @template dir
Expand All @@ -91,6 +97,7 @@ unname_chunks <- function(path, chunk_name_prefix = NULL) {
unname_dir_chunks <- function(dir){
rmds <- fs::dir_ls(dir, regexp = "*.[Rr]md")
purrr::walk(rmds, chatty_unname_chunks)
return(invisible(TRUE))
}

chatty_unname_chunks <- function(path){
Expand Down
5 changes: 4 additions & 1 deletion R/utils-pipe.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#' Pipe operator
#'
#' See `magrittr::[\%>\%][magrittr::\%>\%]` for details.
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
#' @param lhs A value or the magrittr placeholder.
#' @param rhs A function call using the magrittr semantics.
#' @return The result of calling `rhs(lhs)`.
NULL
3 changes: 3 additions & 0 deletions man/name_chunks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/name_dir_chunks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion man/pipe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/unname_chunks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/unname_dir_chunks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14e323f

Please sign in to comment.