add version

This commit is contained in:
2025-11-26 14:46:46 +08:00
parent 434beeab2d
commit 6ca342f89d
6 changed files with 73 additions and 5 deletions
+2 -2
View File
@@ -14,8 +14,8 @@
\newlabel{r:r1q0101}{{This is something useful according to Reviewer 1.}{}} \newlabel{r:r1q0101}{{This is something useful according to Reviewer 1.}{}}
\newlabel{r1q0101}{{1}{3}{\texorpdfstring {Main}{Main}}{section.1}{}} \newlabel{r1q0101}{{1}{3}{\texorpdfstring {Main}{Main}}{section.1}{}}
\newlabel{r1q0101end}{{1}{3}{\texorpdfstring {Main}{Main}}{section.1}{}} \newlabel{r1q0101end}{{1}{3}{\texorpdfstring {Main}{Main}}{section.1}{}}
\newlabel{line:r1q0101}{{11}{3}{}{}{}} \newlabel{line:r1q0101}{{12}{3}{}{}{}}
\newlabel{line:r1q0101end}{{11}{3}{}{}{}} \newlabel{line:r1q0101end}{{12}{3}{}{}{}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Methods}{3}{section.2}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {2}Methods}{3}{section.2}\protected@file@percent }
\newlabel{methods}{{2}{3}{\texorpdfstring {Methods}{Methods}}{section.2}{}} \newlabel{methods}{{2}{3}{\texorpdfstring {Methods}{Methods}}{section.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3}Results}{3}{section.3}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {3}Results}{3}{section.3}\protected@file@percent }
+2
View File
@@ -51,6 +51,8 @@ dwfun::init()
# Abstract {-} # Abstract {-}
This is the abstract.
{{< pagebreak >}} {{< pagebreak >}}
{{< include MS_main.qmd >}} {{< include MS_main.qmd >}}
+2 -1
View File
@@ -3,6 +3,7 @@ project:
output-dir: www/ output-dir: www/
render: render:
- index.qmd - index.qmd
- version.qmd
- MS/SM.qmd - MS/SM.qmd
- MS/MS.qmd - MS/MS.qmd
- MS/CL.qmd - MS/CL.qmd
@@ -128,7 +129,7 @@ website:
- text: "Links" - text: "Links"
menu: menu:
- text: "Version" - text: "Version"
href: https://drc.drwater.net/{{< var projtype >}}/{{< var pubtype >}}/{{< var reponame >}}/ href: version.qmd
- text: "DRC" - text: "DRC"
href: "https://drc.drwater.net/" href: "https://drc.drwater.net/"
- text: "Dr. Water" - text: "Dr. Water"
+2 -1
View File
@@ -1,5 +1,6 @@
--- ---
title: "About" title: "About"
author: ""
--- ---
About this site About this site.
+1 -1
View File
@@ -7,7 +7,7 @@ engine: knitr
```{r} ```{r}
#| echo: false #| echo: false
#| out-width: 100% #| out-width: 100%
dwfun::ggsavep("./figures/GA20240729.pdf", loadit = TRUE) # dwfun::ggsavep("./figures/GA20240729.pdf", loadit = TRUE)
``` ```
+64
View File
@@ -0,0 +1,64 @@
---
subtitle: "Version"
author: ""
---
### Branches
```{r}
#| echo: false
#| output: asis
tibble::tibble(branch = system("git branch -a", intern = TRUE)) |>
dplyr::filter(grepl("remotes", branch)) |>
dplyr::filter(!grepl("HEAD", branch)) |>
dplyr::mutate(branch = gsub("^.*\\/", "", branch)) |>
dplyr::mutate(
htmlstr = paste0(
"## [**Version**: ",
branch,
"](https://drc.drwater.net/{{< var projtype >}}/{{< var pubtype >}}/{{< var reponame >}}/",
branch,
"/)<br><br>"
)
) |>
dplyr::pull(htmlstr) |>
paste(collapse = "") |>
cat()
```
### Versions
```{r}
#| echo: false
#| output: asis
# 方法2:先获取分支列表,再逐个查询
branches <- system("git branch -r", intern = TRUE)
branches <- trimws(branches) # 去除空白字符
branches <- branches[!grepl("HEAD", branches)]
all_commits <- list()
cat("\n")
for (branch in branches) {
if (branch != "") {
cat("### ", gsub("^.*/", "", branch), "\n\n")
commits <- system(
paste0(
"git log --pretty=format:\"%h - %an, %ar : %s\" -5 \"",
branch,
"\""
),
intern = TRUE
)
all_commits[[branch]] <- paste0("- ", commits)
cat("\n")
cat(paste0("- ", commits), sep = "\n")
cat("\n\n")
}
}
```