From 02064f6baa3b4f5d30a0b18a612270ca6894ffb8 Mon Sep 17 00:00:00 2001 From: Elizabeth Perl Date: Fri, 16 Aug 2024 14:05:12 -0400 Subject: [PATCH] Find max data-number for reference section instead of hard coded number (#247) --- .github/workflows/build-ss3-manual-html.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ss3-manual-html.yml b/.github/workflows/build-ss3-manual-html.yml index 8334006..61330cb 100644 --- a/.github/workflows/build-ss3-manual-html.yml +++ b/.github/workflows/build-ss3-manual-html.yml @@ -137,13 +137,17 @@ jobs: # Add title to references where_add <- (grep("references csl-bib-body hanging-indent", html_txt, fixed = TRUE) - 1) + dat_num <- grep("data-number", html_txt) + dat_num_actual <- html_txt[dat_num] + dat_num_actual <- gsub(".*data-number=", "", dat_num_actual) + ref_num <- max(as.numeric(sub("\\D*(\\d+).*", "\\1", dat_num_actual))) + 1 html_txt <- append(html_txt, - '

17 References

', + paste0('

', ref_num, ' References

'), after = where_add) # Add references to table of contents where_add <- grep("", html_txt, fixed = TRUE)-2 html_txt <- append(html_txt, - '
  • 17 References
  • ', + paste0('
  • ', ref_num, ' References
  • '), after = where_add) writeLines(html_txt, "SS330_User_Manual.html") shell: Rscript {0}