[Hotfix]: issues with rerendering and custom sections#412
[Hotfix]: issues with rerendering and custom sections#412Schiano-NOAA merged 11 commits intomainfrom
Conversation
New version checklist
|
Checklist
|
Code Metrics Report
Code coverage of files in pull request scope (48.2%)
Reported by octocov |
There was a problem hiding this comment.
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.
|
Reran the answers to the advanced create_template() exercises. This worked! This left an empty Also, the bug in this issue was resolved! #410 |
sbreitbart-NOAA
left a comment
There was a problem hiding this comment.
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>
New version checklist
|
|
@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 😄 |
New version checklist
|
New version checklist
|
What is the feature?
How have you implemented the solution?
Does the PR impact any other area of the project, maybe another repo?
*no