Skip to content

Commit

Permalink
add fix for weird home file badness
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Aug 22, 2023
1 parent e2bc41f commit 6598e16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/build_home.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ build_home <- function(pkg, quiet, next_page = NULL) {
setup <- xml2::read_html(setup)
fix_nodes(setup)

nav <- get_nav_data(idx_file, page_forward = next_page)
idx_src <- fs::path(path, fs::path_file(idx_file))
nav <- get_nav_data(idx_file, idx_src, page_forward = next_page)
needs_title <- nav$pagetitle == ""

if (needs_title) {
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-overview.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ test_that("Lessons without episodes can be built", {
expect_true(fs::dir_exists(fs::path(lsn, "site", "built")))
expect_true(fs::dir_exists(fs::path(lsn, "site", "docs")))

# read in index and make sure the destinations are correct
idx_file <- fs::path(lsn, "site", "docs", "index.html")
expect_true(fs::file_exists(idx_file))
idx <- xml2::read_html(idx_file)
edit_link <- xml2::xml_find_first(idx, ".//a[text()='Edit on GitHub']")
expect_match(xml2::xml_attr(edit_link, "href"), "edit/main/index.md")

})


Expand Down

0 comments on commit 6598e16

Please sign in to comment.