Skip to content

[Hotfix]: issues with rerendering and custom sections#412

Merged
Schiano-NOAA merged 11 commits intomainfrom
hotfix-custom-sec
Jan 20, 2026
Merged

[Hotfix]: issues with rerendering and custom sections#412
Schiano-NOAA merged 11 commits intomainfrom
hotfix-custom-sec

Conversation

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator

What is the feature?

  • Fixed minor issues with parts of the rerendering process
  • Fixed misplacement of custom sections found when running examples for workshops

How have you implemented the solution?

  • See code - fixed small issues in multiple functions

Does the PR impact any other area of the project, maybe another repo?

*no

@github-actions
Copy link
Copy Markdown
Contributor

New version checklist

  • Package version in DESCRIPTION has been updated
  • Release notes have been drafted/published
  • Cheatsheet content has been updated (if applicable)
  • Cheatsheet version has been updated

@github-actions
Copy link
Copy Markdown
Contributor

Checklist

  • PR base branch is accurate
  • Is the code concise?
  • Comments are clear and useful.
  • Can you remove or combine any arguments?
  • Do argument contain defaults (if appliable)?
  • Code is documented and example provided (Roxygen).
  • Did you make a test (testthat)?
  • Was this tested under multiple scenarios?
  • Did you run devtools::check()?

@github-actions
Copy link
Copy Markdown
Contributor

Code Metrics Report

Coverage Code to Test Ratio Test Execution Time
37.8% 1:0.2 27s

Code coverage of files in pull request scope (48.2%)

Files Coverage
R/add_authors.R 47.0%
R/create_citation.R 71.2%
R/create_template.R 41.5%
R/create_title.R 91.8%
R/create_yaml.R 51.2%

Reported by octocov

@Schiano-NOAA Schiano-NOAA marked this pull request as ready for review January 15, 2026 19:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This hotfix addresses issues with the rerendering process and custom section placement that were discovered during workshop examples. The changes include fixes for parameter handling, region extraction, file path references, and section ordering.

Changes:

  • Fixed conditional logic for author addition and region parameter handling in YAML creation
  • Corrected species name extraction and region handling during template rerendering
  • Fixed custom section ordering to properly include tables and figures documents

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
R/create_yaml.R Fixed author list conditional check, updated species parameter matching, added region parameter handling, and corrected output file naming
R/create_title.R Added null check for spp_latin parameter before applying LaTeX formatting
R/create_template.R Fixed region extraction, species name handling, citation updates, year fallback logic, and custom section ordering
R/create_citation.R Removed commented-out code for authorship lookup
R/add_authors.R Fixed loop iteration to use correct vector length
Comments suppressed due to low confidence (1)

R/create_template.R:812

  • This entire params_chunk creation block (lines 791-813) is duplicated from the else branch above (lines 767-789). The code should be refactored to avoid this duplication, perhaps by moving this logic outside the if-else statement.
      paste0(
        "# Parameters \n",
        "spp <- params$species \n",
        "SPP <- params$spp \n",
        "species <- params$species \n",
        "spp_latin <- params$spp_latin \n",
        "office <- params$office",
        if (!is.null(region)) {
          paste0(
            "\n",
            "region <- params$region"
          )
        },
        if (!is.null(param_names)) {
          paste0(
            "\n",
            paste0(param_names, " <- ", "params$", param_names, collapse = " \n")
          )
        }
      ),
      label = "doc_parameters"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbreitbart-NOAA sbreitbart-NOAA linked an issue Jan 15, 2026 that may be closed by this pull request
@sbreitbart-NOAA
Copy link
Copy Markdown
Collaborator

Reran the answers to the advanced create_template() exercises.

This worked!

asar::create_template(
    authors = c("Samantha Schiano" = "OST"),
    custom = TRUE,
    custom_sections = c("executive_summary", "introduction")
)

This left an empty cover: in the yaml, saved the param species: as "species" and spp_latin empty, but those are minor things that can be fixed at another time (and I think you already know about?):

asar::create_template(
  rerender_skeleton = TRUE,
  species = "Petrale sole",
  spp_latin = "Eopsetta jordani",
  file_dir = file.path("report")
)

Also, the bug in this issue was resolved! #410

Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA sbreitbart-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done as extensive testing as I usually would, but I tested out a few distinct situations, including the code in the workshop, and it either works perfectly or seems good enough (see my comment). Nice job!!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

New version checklist

  • Package version in DESCRIPTION has been updated
  • Release notes have been drafted/published
  • Cheatsheet content has been updated (if applicable)
  • Cheatsheet version has been updated

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA sorry for the delay and thanks for the review! Were you running the above example with the right branch? I ran this and it worked. I specifically fixed these issues so I'm not sure why it wouldn't be working unless the package version isn't correct. Either way, I am going to merge since it's minor 😄

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 20, 2026

New version checklist

  • Package version in DESCRIPTION has been updated
  • Release notes have been drafted/published
  • Cheatsheet content has been updated (if applicable)
  • Cheatsheet version has been updated

@github-actions
Copy link
Copy Markdown
Contributor

New version checklist

  • Package version in DESCRIPTION has been updated
  • Release notes have been drafted/published
  • Cheatsheet content has been updated (if applicable)
  • Cheatsheet version has been updated

@Schiano-NOAA Schiano-NOAA merged commit d5514c2 into main Jan 20, 2026
6 checks passed
@Schiano-NOAA Schiano-NOAA deleted the hotfix-custom-sec branch January 20, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: create_template() custom sections not added properly

3 participants