Skip to content

Commit

Permalink
Use YAML for comment
Browse files Browse the repository at this point in the history
  • Loading branch information
willgearty committed Oct 1, 2024
1 parent a2a38e0 commit 571aa72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions vignettes/precompile.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ build_vignettes()

# x = vignette file name including file extension (e.g., "rredlist.Rmd")
read_only <- function(x) {
# Create file
tmp <- file(x)
nlines <- grep("^---\\s*$", readLines(x))[2]
writeLines(
c(readLines(x)[1:(nlines + 1)],
paste0("<!-- Generated by vignettes/precompile.R: do not edit by hand.\n",
"Please edit source in vignettes/source/_", x, " -->"),
readLines(x)[(nlines + 2):length(readLines(x))]), tmp)
# write lines
writeLines(c(c("---"),
c("comment: >"),
c(" Generated by vignettes/precompile.R: do not edit by hand."),
paste0(" Please edit source in vignettes/source/_", x),
readLines(x)[2:length(readLines(x))]), tmp)
close(tmp)
}
# Add read only info
Expand Down
5 changes: 3 additions & 2 deletions vignettes/rredlist.Rmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
comment: >
Generated by vignettes/precompile.R: do not edit by hand.
Please edit source in vignettes/source/_rredlist.Rmd
title: "Introduction to rredlist"
author: "William Gearty"
date: "2024-10-01"
Expand All @@ -9,8 +12,6 @@ vignette: >
%\VignetteEncoding{UTF-8}
---

<!-- Generated by vignettes/precompile.R: do not edit by hand.
Please edit source in vignettes/source/_rredlist.Rmd -->


`rredlist` is an R client for the IUCN Red List API (https://api.iucnredlist.org/).
Expand Down

0 comments on commit 571aa72

Please sign in to comment.