From d6b3e0721654ff9a71a7e1c8309f0a0126210962 Mon Sep 17 00:00:00 2001 From: jangorecki Date: Fri, 18 Oct 2024 01:03:26 +0200 Subject: [PATCH] more info --- .github/workflows/pkgup.yaml | 1 + docs/vignettes.Rmd | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pkgup.yaml b/.github/workflows/pkgup.yaml index c0d4179..33c1e94 100644 --- a/.github/workflows/pkgup.yaml +++ b/.github/workflows/pkgup.yaml @@ -46,6 +46,7 @@ jobs: Rscript -e 'litedown::fuse_site("docs")' mkdir -p public find docs -name '*.html' -print0 | cpio -pvdmB --null public + ls -R public mv public/docs/* public rm -r public/docs - name: repo diff --git a/docs/vignettes.Rmd b/docs/vignettes.Rmd index 87484c9..e79e36c 100644 --- a/docs/vignettes.Rmd +++ b/docs/vignettes.Rmd @@ -6,20 +6,24 @@ if (tail(strsplit(getwd(), "/", fixed=TRUE)[[1L]], 1L) == "docs") { } invisible(file.copy("../vignettes", ".", recursive=TRUE)) rmd = list.files("./vignettes", "*.Rmd", full.names=TRUE) -html = list.files("./vignettes", "*.html", full.names=TRUE) -title = function(f) { - title1 = function(f) { - l = readLines(f) - t = paste(head(strsplit(basename(f), ".", fixed=TRUE)[[1L]], -1L), collapse=".") ## default, basename without extension - for (i in seq_along(l)) { - if (substr(l[i], 1L, 6L) != "title:") - next - t = trimws(gsub("title:", "", l[i], fixed=TRUE)) - break +if (!length(rmd)) { + cat("no vignettes\n") +} else { + title = function(f) { + title1 = function(f) { + l = readLines(f) + t = paste(head(strsplit(basename(f), ".", fixed=TRUE)[[1L]], -1L), collapse=".") ## default, basename without extension + for (i in seq_along(l)) { + if (substr(l[i], 1L, 6L) != "title:") + next + t = trimws(gsub("title:", "", l[i], fixed=TRUE)) + break + } + t } - t + sapply(f, title1) } - sapply(f, title1) + html = list.files("./vignettes", "*.html", full.names=TRUE) + lapply(html, function(f) cat(sprintf("[%s](%s)\n", title(rmd), f))) |> invisible() } -lapply(html, function(f) cat(sprintf("[%s](%s)\n", title(rmd), f))) |> invisible() ```