diff --git a/vignettes/precompile.R b/vignettes/precompile.R index 01ec1be..07d9430 100644 --- a/vignettes/precompile.R +++ b/vignettes/precompile.R @@ -7,19 +7,21 @@ old_wd <- getwd() setwd("vignettes/") # Precompile vignettes library(knitr) -knit("./.source/rredlist.Rmd", "rredlist.Rmd") +knit("./source/_rredlist.Rmd", "rredlist.Rmd") # Build vignettes library(devtools) build_vignettes() -# x = vignette file name including file extension (e.g. "rredlist.Rmd") +# x = vignette file name including file extension (e.g., "rredlist.Rmd") read_only <- function(x) { tmp <- file(x) - writeLines(c( - paste0("% Generated by vignettes/precompile.R: do not edit by hand.\n", - "% Please edit source in vignettes/.source/", x), - readLines(x)), tmp) + nlines <- grep("^---\\s*$", readLines(x))[2] + writeLines( + c(readLines(x)[1:(nlines + 1)], + paste0(""), + readLines(x)[(nlines + 2):length(readLines(x))]), tmp) close(tmp) } # Add read only info diff --git a/vignettes/rredlist.Rmd b/vignettes/rredlist.Rmd index 9d2c41e..5e5ea59 100644 --- a/vignettes/rredlist.Rmd +++ b/vignettes/rredlist.Rmd @@ -1,9 +1,7 @@ -% 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-09-30" +date: "2024-10-01" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to rredlist} @@ -11,6 +9,8 @@ vignette: > %\VignetteEncoding{UTF-8} --- + `rredlist` is an R client for the IUCN Red List API (https://api.iucnredlist.org/). @@ -18,7 +18,7 @@ The [IUCN Red List](https://www.iucnredlist.org/) is the world’s most comprehe Documentation for the IUCN Red List API are available at https://api.iucnredlist.org/api-docs. **Note that use of the web API, and therefore this package, [requires authentication](#authentication).** -### What `rredlist` is not +#### What `rredlist` is not: 1. [`redlistr`](https://cran.r-project.org/package=redlistr) is a different package for contributors to the IUCN Red List - not working with the IUCN Red List API. 2. `rredlist` does not include support for the spatial API, described at https://apiv3.iucnredlist.org/spatial. diff --git a/vignettes/.source/rredlist.Rmd b/vignettes/source/_rredlist.Rmd similarity index 99% rename from vignettes/.source/rredlist.Rmd rename to vignettes/source/_rredlist.Rmd index fa9fa7e..7e9054b 100644 --- a/vignettes/.source/rredlist.Rmd +++ b/vignettes/source/_rredlist.Rmd @@ -49,7 +49,7 @@ The [IUCN Red List](https://www.iucnredlist.org/) is the world’s most comprehe Documentation for the IUCN Red List API are available at https://api.iucnredlist.org/api-docs. **Note that use of the web API, and therefore this package, [requires authentication](#authentication).** -### What `rredlist` is not +#### What `rredlist` is not: 1. [`redlistr`](https://cran.r-project.org/package=redlistr) is a different package for contributors to the IUCN Red List - not working with the IUCN Red List API. 2. `rredlist` does not include support for the spatial API, described at https://apiv3.iucnredlist.org/spatial.