From fc49543313938aefd7b9611a74f6c3796791639c Mon Sep 17 00:00:00 2001 From: Michael Kane Date: Tue, 1 Nov 2022 18:53:25 -0400 Subject: [PATCH] Bug fixing on html paths. --- DESCRIPTION | 2 +- R/build-site.r | 8 ++++---- man/ld_site_yaml.Rd | 4 ++-- tests/testthat/test-create-html-site.r | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0c388f6..a0feba5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,5 +27,5 @@ Enhances: workflowr URL: https://github.com/kaneplusplus/listdown BugReports: https://github.com/kaneplusplus/listdown/issues -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.1 VignetteBuilder: knitr diff --git a/R/build-site.r b/R/build-site.r index 2962626..4dfb009 100644 --- a/R/build-site.r +++ b/R/build-site.r @@ -104,7 +104,7 @@ remove_file_extension <- function(x) { ) } -#' Create a Minimalist Site YAML List +#' Create a Minimal Site YAML List #' #' @param site_name the name of the site. #' @param tab_name the name of the tabs on the site. @@ -243,9 +243,8 @@ ld_build_html_site <- if (length(data_dir) != 1 && length(data_dir) != length(doc_bundles)) { stop("The data directory must be a single directory or one per bundle.") } - if (is.null(site_yaml$output_dir) || site_yaml$output_dir == "") { - site_yaml$output_dir <- html_dir + site_yaml$output_dir <- path_rel(html_dir, rmd_dir) } else { warning(paste("Output dir specified in yaml list. The `html_dir`", "argument will be ignored.")) @@ -299,10 +298,11 @@ ld_build_html_site <- render_doc = FALSE) } write_yaml(site_yaml, file.path(rmd_dir, "_site.yml")) + if (render_site) { render_site(rmd_dir, ...) if (view) { - browseURL(file.path(rmd_dir, html_dir, "index.html")) + browseURL(file.path(rmd_dir, site_yaml$output_dir, "index.html")) } } normalizePath(file.path(html_dir, "index.html"), mustWork = FALSE) diff --git a/man/ld_site_yaml.Rd b/man/ld_site_yaml.Rd index 1770402..09f3a9d 100644 --- a/man/ld_site_yaml.Rd +++ b/man/ld_site_yaml.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/build-site.r \name{ld_site_yaml} \alias{ld_site_yaml} -\title{Create a Minimalist Site YAML List} +\title{Create a Minimal Site YAML List} \usage{ ld_site_yaml(site_name, tab_name, rmd_name, navbar_title = site_name) } @@ -18,5 +18,5 @@ respective tabs.} `site_name` argument.} } \description{ -Create a Minimalist Site YAML List +Create a Minimal Site YAML List } diff --git a/tests/testthat/test-create-html-site.r b/tests/testthat/test-create-html-site.r index 2040639..4ccd5bc 100644 --- a/tests/testthat/test-create-html-site.r +++ b/tests/testthat/test-create-html-site.r @@ -60,7 +60,7 @@ test_that("Site can be built.", { pages, site_yaml, view = TRUE, - quiet = TRUE) + quiet = FALSE) expect_equal(basename(site_path), "index.html") })