read all HTML files in a folder
Value
a nested list of html_documents
from xml2::read_html()
with two
top-level elements:
$learner
: contains all of the html pages in the learner view$instructor
: all of the pages in the instructor view$paths
: the absolute paths for the pages
Examples
tmpdir <- tempfile()
on.exit(fs::dir_delete(tmpdir))
#> Error: [ENOENT] Failed to search directory '/tmp/RtmpeI6Keh/file16e5e6b7f53': no such file or directory
fs::dir_create(tmpdir)
fs::dir_create(fs::path(tmpdir, "instructor"))
writeLines("<p>Instructor</p>", fs::path(tmpdir, "instructor", "index.html"))
writeLines("<p>Learner</p>", fs::path(tmpdir, "index.html"))
sandpaper:::read_all_html(tmpdir)
#> $instructor
#> $instructor$index
#> {html_document}
#> <html>
#> [1] <body><p>Instructor</p></body>
#>
#>
#> $learner
#> $learner$index
#> {html_document}
#> <html>
#> [1] <body><p>Learner</p></body>
#>
#>
#> $paths
#> /tmp/RtmpeI6Keh/file16e5e6b7f53/index.html
#> /tmp/RtmpeI6Keh/file16e5e6b7f53/instructor/index.html
#>