diff --git a/DESCRIPTION b/DESCRIPTION index a550f30..f9ecd70 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ttmeta Title: TidyTuesday Dataset Metadata -Version: 0.1.0 +Version: 0.1.0.20240618 Authors@R: person("Jon", "Harmon", , "jonthegeek@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-4781-4346")) @@ -16,8 +16,11 @@ Imports: cli, dplyr, fastmatch, + gh, glue, + jsonlite, lubridate, + markdown, purrr, rlang, rvest, @@ -39,4 +42,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/R/html.R b/R/html.R index 354bc01..4e60c51 100644 --- a/R/html.R +++ b/R/html.R @@ -100,16 +100,28 @@ #' @keywords internal .tt_year_readme_table <- function(year, table_number) { all_tables <- rvest::read_html( - glue::glue( - .tt_gh_base, - "data/{year}/readme.md" - ) + .tt_year_readme_html(year) ) |> xml2::xml_find_all(".//tbody") return(all_tables[[table_number]]) } +.tt_year_readme_html <- function(year) { + .tt_year_readme_md(year) |> + markdown::mark_html() +} + +.tt_year_readme_md <- function(year) { + md_content <- gh::gh( + "/repos/rfordatascience/tidytuesday/contents/data/{year}/readme.md", + year = year + ) + md_content$content |> + jsonlite::base64_dec() |> + rawToChar() +} + #' Extract all tables from a document #' #' @param x An xml (html) object or a subset thereof. diff --git a/data/tt_datasets_metadata.rda b/data/tt_datasets_metadata.rda index a0a75a6..5c22025 100644 Binary files a/data/tt_datasets_metadata.rda and b/data/tt_datasets_metadata.rda differ diff --git a/data/tt_summary_tbl.rda b/data/tt_summary_tbl.rda index a86830e..baf81d5 100644 Binary files a/data/tt_summary_tbl.rda and b/data/tt_summary_tbl.rda differ diff --git a/data/tt_urls_tbl.rda b/data/tt_urls_tbl.rda index cc9cd11..818b2d6 100644 Binary files a/data/tt_urls_tbl.rda and b/data/tt_urls_tbl.rda differ