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() ```