diff --git a/.Rbuildignore b/.Rbuildignore index 66e6bbc8..bbd71eb8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,6 @@ ^scripts ^\.github$ ^revdep$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 00000000..cd356765 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,85 @@ +on: + push: + branches: + - master + - rc-** + pull_request: + branches: master + +name: pkgdown + +jobs: + pkgdown: + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + env: + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@master + id: install-r + with: + r-version: ${{ matrix.config.r }} + + - uses: r-lib/actions/setup-pandoc@master + + - name: Install pak and query dependencies + shell: Rscript {0} + run: | + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds") + - name: Cache R packages + uses: actions/cache@v2 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-pkgdown-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: | + ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-pkgdown- + ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + shell: Rscript {0} + run: | + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("pkgdown", execute = TRUE) + + - name: Install dependencies + shell: Rscript {0} + run: | + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("pkgdown") + + - name: Install package + run: R CMD INSTALL . + + - name: Build Site (PR) + if: github.event_name != 'push' + shell: Rscript {0} + run: | + pkgdown::build_site(new_process = FALSE) + # Must validate after. Otherwise files are saved and `pkgdown::build_site()` gets mad + - name: Validate all topics exist (PR) + if: github.event_name != 'push' + shell: Rscript {0} + run: | + pkgdown::build_reference_index() + stopifnot(length(warnings()) == 0) + + - name: Git Config + if: github.event_name == 'push' + run: | + git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ + git config --local user.name "${GITHUB_ACTOR}" + + - name: Build and Deploy Site + if: github.event_name == 'push' + shell: Rscript {0} + run: | + pkgdown::deploy_to_branch(new_process = FALSE) diff --git a/.gitignore b/.gitignore index 6af5fee0..190e5e23 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .Rhistory .RData .*.Rnb.cached +docs diff --git a/DESCRIPTION b/DESCRIPTION index 26aa12cb..b42957d2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: htmltools Type: Package Title: Tools for HTML -Version: 0.5.1.9000 +Version: 0.5.1.9001 Authors@R: c( person("Joe", "Cheng", role = "aut", email = "joe@rstudio.com"), person("Carson", "Sievert", role = c("aut", "cre"), email = "carson@rstudio.com", comment = c(ORCID = "0000-0002-4958-2844")), @@ -49,3 +49,4 @@ Collate: 'utils.R' 'tags.R' 'template.R' +Roxygen: list(markdown = TRUE) diff --git a/R/colors.R b/R/colors.R index 47776687..aee1ac04 100644 --- a/R/colors.R +++ b/R/colors.R @@ -27,7 +27,6 @@ #' "hsl(261, 51%, 51%)", #' "cornflowerblue" #' )) -#' @md #' @export parseCssColors <- function(str, mustWork = TRUE) { # Logic below assumes a character string with non-missing values diff --git a/R/html_dependency.R b/R/html_dependency.R index 8eefd5e1..14b533aa 100644 --- a/R/html_dependency.R +++ b/R/html_dependency.R @@ -13,77 +13,77 @@ #' Details. #' @param meta Named list of meta tags to insert into document head #' @param script Script(s) to include within the document head (should be -#' specified relative to the \code{src} parameter). +#' specified relative to the `src` parameter). #' @param stylesheet Stylesheet(s) to include within the document (should be -#' specified relative to the \code{src} parameter). +#' specified relative to the `src` parameter). #' @param head Arbitrary lines of HTML to insert into the document head #' @param attachment Attachment(s) to include within the document head. See #' Details. -#' @param package An R package name to indicate where to find the \code{src} -#' directory when \code{src} is a relative path (see -#' \code{\link{resolveDependencies}}). -#' @param all_files Whether all files under the \code{src} directory are -#' dependency files. If \code{FALSE}, only the files specified in -#' \code{script}, \code{stylesheet}, and \code{attachment} are treated as +#' @param package An R package name to indicate where to find the `src` +#' directory when `src` is a relative path (see +#' [resolveDependencies()]). +#' @param all_files Whether all files under the `src` directory are +#' dependency files. If `FALSE`, only the files specified in +#' `script`, `stylesheet`, and `attachment` are treated as #' dependency files. #' #' @return An object that can be included in a list of dependencies passed to -#' \code{\link{attachDependencies}}. +#' [attachDependencies()]. #' #' @details Each dependency can be located on the filesystem, at a relative or #' absolute URL, or both. The location types are indicated using the names of -#' the \code{src} character vector: \code{file} for filesystem directory, -#' \code{href} for URL. For example, a dependency that was both on disk and at -#' a URL might use \code{src = c(file=filepath, href=url)}. +#' the `src` character vector: `file` for filesystem directory, +#' `href` for URL. For example, a dependency that was both on disk and at +#' a URL might use `src = c(file=filepath, href=url)`. #' -#' \code{script} can be given as one of the following: +#' `script` can be given as one of the following: #' \itemize{ #' \item a character vector specifying various scripts to include relative to the -#' value of \code{src}. -#' Each is expanded into its own \code{