diff --git a/.github/workflows/pkgup.yaml b/.github/workflows/pkgup.yaml index 9203e0c..41e9cca 100644 --- a/.github/workflows/pkgup.yaml +++ b/.github/workflows/pkgup.yaml @@ -41,9 +41,12 @@ jobs: - name: doc if: github.ref == 'refs/heads/master' run: | - rm -rf .pkgup/doc mkdir -p .pkgup/doc/vignettes - rsync -r --exclude 'doc' --exclude 'repo' .pkgup/* .pkgup/doc/ + echo -e "output:\n litedown::html_format:\n options:\n toc:\n depth: 4\n litedown::latex_format:\n meta:\n documentclass: \"book\"\n\nbook:\n new_session: false\n subdir: true\n pattern: \"[.]R?md$\"\n chapter_before: \"Information before a chapter.\"\n chapter_after: \"This chapter was generated from `$input$`.\"" > pkgup/doc/_litedown.yml + echo -e "---\nsite:\n rebuild: \"outdated\"\n pattern: \"[.]R?md$\"\n---\n\n```{r, echo=FALSE}\nlitedown::pkg_desc()\n```\n\nTo cite the package:\n\n```{r, echo=FALSE}\nlitedown::pkg_citation()\n```" > .pkgup/doc/index.Rmd + echo -e "```{r, echo=FALSE}\nlitedown::pkg_manual()\n```" > .pkgup/doc/manual.Rmd + echo -e "```{r, echo=FALSE}\nlitedown::pkg_news(recent=0)\n```" > .pkgup/doc/news.Rmd + echo -e "```{r, echo=FALSE, results='asis'}\nrmd = list.files(\"./vignettes\", \"*.Rmd\", full.names=TRUE)\nif (!length(rmd)) {\n cat(\"no vignettes\\n\")\n} else {\n title = function(f) {\n title1 = function(f) {\n if (!file.exists(f))\n stop(\"file \", f, \" does not exists\")\n l = readLines(f)\n t = paste(head(strsplit(basename(f), \".\", fixed=TRUE)[[1L]], -1L), collapse=\".\") ## default, basename without extension\n for (i in seq_along(l)) {\n if (substr(l[i], 1L, 6L) != \"title:\")\n next\n t = trimws(gsub(\"title:\", \"\", l[i], fixed=TRUE))\n break\n }\n t\n }\n sapply(f, title1)\n }\n html = paste0(substr(rmd, 1L, nchar(rmd)-3L), \"html\")\n lapply(html, function(f) cat(sprintf(\"[%s](%s)\\n\", title(rmd), f))) |> invisible()\n}\n```" > .pkgup/doc/vignettes.Rmd cp -r vignettes/* .pkgup/doc/vignettes/ R CMD INSTALL $(ls -1t pkgup_*.tar.gz | head -n 1) Rscript -e 'litedown::fuse_site(".pkgup/doc")' @@ -51,7 +54,6 @@ jobs: - name: repo if: github.ref == 'refs/heads/master' run: | - rm -rf .pkgup/repo mkdir -p .pkgup/repo/src/contrib mv "$(ls -1t pkgup_*.tar.gz | head -n 1)" .pkgup/repo/src/contrib Rscript -e 'tools::write_PACKAGES(".pkgup/repo/src/contrib", fields="Revision")' diff --git a/.pkgup/_litedown.yml b/.pkgup/_litedown.yml deleted file mode 100644 index f0a5b39..0000000 --- a/.pkgup/_litedown.yml +++ /dev/null @@ -1,15 +0,0 @@ -output: - litedown::html_format: - options: - toc: - depth: 4 - litedown::latex_format: - meta: - documentclass: "book" - -book: - new_session: false - subdir: true - pattern: "[.]R?md$" - chapter_before: "Information before a chapter." - chapter_after: "This chapter was generated from `$input$`." diff --git a/.pkgup/index.Rmd b/.pkgup/index.Rmd deleted file mode 100644 index 2bd1740..0000000 --- a/.pkgup/index.Rmd +++ /dev/null @@ -1,15 +0,0 @@ ---- -site: - rebuild: "outdated" - pattern: "[.]R?md$" ---- - -```{r, echo=FALSE} -litedown::pkg_desc() -``` - -To cite the package: - -```{r, echo=FALSE} -litedown::pkg_citation() -``` diff --git a/.pkgup/manual.Rmd b/.pkgup/manual.Rmd deleted file mode 100644 index a9a9cb7..0000000 --- a/.pkgup/manual.Rmd +++ /dev/null @@ -1,3 +0,0 @@ -```{r, echo=FALSE} -litedown::pkg_manual() -``` diff --git a/.pkgup/news.Rmd b/.pkgup/news.Rmd deleted file mode 100644 index b9458a7..0000000 --- a/.pkgup/news.Rmd +++ /dev/null @@ -1,3 +0,0 @@ -```{r, echo=FALSE} -litedown::pkg_news(recent=0) -``` diff --git a/.pkgup/vignettes.Rmd b/.pkgup/vignettes.Rmd deleted file mode 100644 index 0142eeb..0000000 --- a/.pkgup/vignettes.Rmd +++ /dev/null @@ -1,25 +0,0 @@ -```{r, echo=FALSE, results='asis'} -rmd = list.files("./vignettes", "*.Rmd", full.names=TRUE) -if (!length(rmd)) { - cat("no vignettes\n") -} else { - title = function(f) { - title1 = function(f) { - if (!file.exists(f)) - stop("file ", f, " does not exists") - 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 - } - sapply(f, title1) - } - html = paste0(substr(rmd, 1L, nchar(rmd)-3L), "html") - lapply(html, function(f) cat(sprintf("[%s](%s)\n", title(rmd), f))) |> invisible() -} -``` diff --git a/vignettes/howto.Rmd b/vignettes/howto.Rmd index b8c5837..fcb5550 100644 --- a/vignettes/howto.Rmd +++ b/vignettes/howto.Rmd @@ -13,7 +13,6 @@ vignette: > ```sh cp pkgup/.github/workflows/pkgup.yaml yourpkg/.github/workflows/pkgup.yaml sed -i 's|pkgup|yourpkg|g' yourpkg/.github/workflows/pkgup.yaml -cp -r .pkgup . ``` If needed, add OS dependencies chunk in `yourpkg/.github/workflows/pkgup.yaml`