update template to adapt new drwater extensions
This commit is contained in:
+33
-5
@@ -1,6 +1,7 @@
|
||||
---
|
||||
subtitle: "研究报告"
|
||||
lang: "zh"
|
||||
format: dwhm-html
|
||||
---
|
||||
|
||||
```{r}
|
||||
@@ -13,13 +14,40 @@ rmdify::rmd_init()
|
||||
|
||||
```{r}
|
||||
#| output: asis
|
||||
|
||||
data.frame(fd = dir(".", pattern = "[-_]")) |>
|
||||
dplyr::mutate(fn = purrr::map_chr(fd, ~ file.path(.x, dir(.x,
|
||||
pattern = "index.qmd|index.doc|index.pdf|index.ppt")))) |>
|
||||
dplyr::transmute(htmlstr = purrr::map_chr(fn, ~ paste0("## [", .x, "](", .x, ")\n\n"))) |>
|
||||
dplyr::filter(!grepl("_files", fd)) |>
|
||||
dplyr::filter(!grepl("quarto", fd)) |>
|
||||
dplyr::mutate(
|
||||
fn = purrr::map_chr(
|
||||
fd,
|
||||
~ file.path(.x, dir(.x, pattern = "index.qmd|index.html"))[1]
|
||||
)
|
||||
) |>
|
||||
dplyr::transmute(
|
||||
htmlstr = purrr::map2_chr(
|
||||
fn,
|
||||
fd,
|
||||
~ paste0(
|
||||
"## [",
|
||||
.y,
|
||||
"](",
|
||||
.x,
|
||||
")\n\n",
|
||||
ifelse(
|
||||
!grepl("qmd$", .x),
|
||||
"",
|
||||
paste0(
|
||||
"<iframe title='",
|
||||
gsub("^.*[_-]([^\\/]*)\\/.*$", "\\1", .x),
|
||||
"' width=800 height=600 src = '",
|
||||
gsub("qmd$", "html", .x),
|
||||
"'></iframe>\n\n"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
) |>
|
||||
dplyr::pull(htmlstr) |>
|
||||
paste(collapse = "") |>
|
||||
cat()
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user