|
7 | 7 | #'
|
8 | 8 | #' Performs various substitutions in all `.R` files in a package
|
9 | 9 | #' (code and tests). One can also (optionally) style `.Rmd`, `.Rmarkdown` and/or
|
10 |
| -#' `.Rnw` files (vignettes and readme) by changing the `filetype` argument. |
| 10 | +#' `.qmd`, `.Rnw` files (vignettes and readme) by changing the `filetype` |
| 11 | +#' argument. |
11 | 12 | #' Carefully examine the results after running this function!
|
12 | 13 | #'
|
13 | 14 | #' @param pkg Path to a (subdirectory of an) R package.
|
@@ -161,6 +162,17 @@ prettify_pkg <- function(transformers,
|
161 | 162 | )
|
162 | 163 | )
|
163 | 164 | }
|
| 165 | + |
| 166 | + if ("\\.qmd" %in% filetype_) { |
| 167 | + vignette_files <- append( |
| 168 | + vignette_files, |
| 169 | + dir_without_.( |
| 170 | + path = ".", |
| 171 | + pattern = "\\.qmd$" |
| 172 | + ) |
| 173 | + ) |
| 174 | + } |
| 175 | + |
164 | 176 | files <- setdiff(
|
165 | 177 | c(r_files, rprofile_files, vignette_files, readme),
|
166 | 178 | exclude_files
|
@@ -214,7 +226,8 @@ style_text <- function(text,
|
214 | 226 |
|
215 | 227 | #' Prettify arbitrary R code
|
216 | 228 | #'
|
217 |
| -#' Performs various substitutions in all `.R`, `.Rmd`, `.Rmarkdown` and/or `.Rnw` files |
| 229 | +#' Performs various substitutions in all `.R`, `.Rmd`, `.Rmarkdown`, `qmd` |
| 230 | +#' and/or `.Rnw` files |
218 | 231 | #' in a directory (by default only `.R` files are styled - see `filetype` argument).
|
219 | 232 | #' Carefully examine the results after running this function!
|
220 | 233 | #' @param path Path to a directory with files to transform.
|
@@ -263,8 +276,8 @@ style_dir <- function(path = ".",
|
263 | 276 | #'
|
264 | 277 | #' This is a helper function for style_dir.
|
265 | 278 | #' @inheritParams style_pkg
|
266 |
| -#' @param recursive A logical value indicating whether or not files in subdirectories |
267 |
| -#' should be styled as well. |
| 279 | +#' @param recursive A logical value indicating whether or not files in |
| 280 | +#' subdirectories should be styled as well. |
268 | 281 | #' @keywords internal
|
269 | 282 | prettify_any <- function(transformers,
|
270 | 283 | filetype,
|
@@ -298,7 +311,7 @@ prettify_any <- function(transformers,
|
298 | 311 | )
|
299 | 312 | }
|
300 | 313 |
|
301 |
| -#' Style `.R`, `.Rmd`, `.Rmarkdown` or `.Rnw` files |
| 314 | +#' Style `.R`, `.Rmd`, `.Rmarkdown`, `.qmd` or `.Rnw` files |
302 | 315 | #'
|
303 | 316 | #' Performs various substitutions in the files specified.
|
304 | 317 | #' Carefully examine the results after running this function!
|
|
0 commit comments