Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject accessibility #124

Merged
merged 42 commits into from
Feb 5, 2025
Merged

Inject accessibility #124

merged 42 commits into from
Feb 5, 2025

Conversation

Schiano-NOAA
Copy link
Collaborator

What is the feature?

*Create a function to increase document accessibility

How have you implemented the solution?

*Create a function, documentation, and testing to edit the latex produced template to add alternative text and tagging using \tagpdf function before the document class structure. The tagging portion will propably be deprecated in the future with the addition of a new partial in the template

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

*no, the function should be used at the end of the stock assessment workflow

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Instructions for code reviewer

Hello reviewer, thanks for taking the time to review this PR!

  • Please use this checklist during your review, checking off items that you have verified are complete!
  • For PRs that don't make changes to code (e.g., changes to README.md or Github actions workflows), feel free to skip over items on the checklist that are not relevant. Remember it is still important to do a thorough review.
  • Then, comment on the pull request with your review indicating where you have questions or changes need to be made before merging.
  • Remember to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do.
  • PR reviews are a great way to learn, so feel free to share your tips and tricks. However, for optional changes (i.e., not required for merging), please include nit: (for nitpicking) before making the suggestion. For example, nit: I prefer using a data.frame() instead of a matrix because...
  • Engage with the developer when they respond to comments and check off additional boxes as they become complete so the PR can be merged in when all the tasks are fulfilled. Make it clear when this has been reached by commenting on the PR with something like This PR is now ready to be merged, no changes needed.

Checklist

  • The PR is requested to be merged into the appropriate branch (typically main)
  • The code is well-designed.
  • The functionality is good for the users of the code.
  • Any User Interface changes are sensible and look good.
  • The code isn’t more complex than it needs to be.
  • Code coverage remains high, indicating the new code is tested.
  • The developer used clear names for everything.
  • Comments are clear and useful, and mostly explain why instead of what.
  • Code is appropriately documented (doxygen and roxygen).

Copy link
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.

Still can't confirm that a rendered pdf has alt text (still having latex installation issues), but otherwise it seems the function does work as expected. This is an important step forward for asar! Besides addressing a few minor comments, looks good!

@Schiano-NOAA
Copy link
Collaborator Author

@sbreitbart-NOAA I made the changes as we discussed and tested if they work. The testing function isn't working exactly how I want so it is not finished, but the functions themselves should be good to go.

@sbreitbart-NOAA
Copy link
Collaborator

@sbreitbart-NOAA I made the changes as we discussed and tested if they work. The testing function isn't working exactly how I want so it is not finished, but the functions themselves should be good to go.

Sounds great, thanks!

@Schiano-NOAA Schiano-NOAA changed the base branch from dev-1.1 to dev January 17, 2025 19:00
@Schiano-NOAA
Copy link
Collaborator Author

@sbreitbart-NOAA this is about ready to merge. I will fix a couple of errors being thrown in testing on thursday, but I want to get this out. The tests for the functions are not complete. Could you specifically test the add_tagging function? I keep ending up with the latex package issues as before and it makes no sense. Thanks!

@Schiano-NOAA Schiano-NOAA added this to the 2025 Q2 Goals milestone Jan 28, 2025
Copy link
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.

Most of my comments are minor and can be addressed quickly. I really like how there are separate functions for adding alt text and tagging, too, and that the user is messaged when steps are completed! I have two larger issues I can't solve, though:

  1. I can't get add_accessibility to work
  2. I can't verify whether compiling works for the smaller fxns too:
  • For add_tagging(), compiling gives this error message: "! LaTeX Error: File `accessibility.tex' not found." I'm not sure if this error is arising because of my mistakes, or because of function issues, because that .tex file is created and saved in the report folder.
  • For add_alttext, compiling gives this error message: "! Package luatex.def Error: File `support_files/Petrale_sole.png' not found: using draft setting." This occurs even though Petrale_sole.png is in the report/support_files directory. Again, is this an error on my part, maybe due to tinytex installation issues?

@Schiano-NOAA
Copy link
Collaborator Author

@sbreitbart-NOAA I think this warrants a very quick review and then merge into dev

Schiano-NOAA and others added 9 commits February 5, 2025 10:35
* update(create_template): comment out skeleton pop up at the end

* update(add_section): add functionality for putting new subsection into section

* Update(add_section): fix pathing for locating section to place code and change from add_chunk to add_child

* update(create_template): select only custom_sections when user wants to make a different outline of report

custom must = TRUE otherwise copies all files

* Fix(create_template): adjust if statement argument for custom_sections

* Add nmfspalette package back in

* removed add_theme and associated test and documentation

* remove static NOAA Fishies in authorship

* update NOAA fisheries affiliations

Co-authored-by: Schiano-NOAA <[email protected]>

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>
….. only satf. Then updated a11y vignette to reflect where users should look for the file.
…p chunk to false, re: #102 . Will change eval to true for all chunks once indices table fxn is completed.
Schiano-NOAA and others added 18 commits February 5, 2025 10:35
…led both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly
* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests
Copy link
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 didn't try add_accessibility. Still having compiling issues with the other two fxns. I wonder if it's a filepath issue? Otherwise, thanks for addressing my other suggestions! Didn't check them all but I saw some associated changes 👍

@Schiano-NOAA Schiano-NOAA merged commit 899f3fb into dev Feb 5, 2025
@Schiano-NOAA Schiano-NOAA deleted the inject-accessibility branch February 5, 2025 21:59
Schiano-NOAA added a commit that referenced this pull request Feb 6, 2025
* Custom template fixes (#143)

* update(create_template): comment out skeleton pop up at the end

* update(add_section): add functionality for putting new subsection into section

* Update(add_section): fix pathing for locating section to place code and change from add_chunk to add_child

* update(create_template): select only custom_sections when user wants to make a different outline of report

custom must = TRUE otherwise copies all files

* Fix(create_template): adjust if statement argument for custom_sections

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>

* Removed captions_alt_text_template.csv because it's not used in asar... only satf. Then updated a11y vignette to reflect where users should look for the file.

* changed eval for first chunk to true, and eval for indices table setup chunk to false, re: #102 . Will change eval to true for all chunks once indices table fxn is completed.

* feature(add new template partial for accessibility and add fxn)

* Update(add_tagging): ability to add alternative text to tex file from rdas

* fix(add_taggig): change directory for rda files to arg

* fix(add_tagging): change pathing to rda_dir

* fix(add-tagging): rename accessibility tex for output

* feature(add_accessibility): rename function and load documentation

* Initial commit for add_accessibility test - commented out bc unfinished

* update(test-add_accessibility): add snapshot for tex file and add proper code for testing

* feature(alter accessibility fxns): split up funxtion into two and called both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly

* Remove nmfspallete from dependencies temporarily (#139)

* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests

* style and docs: run devtools::document() and styler::style_pkg() (#140)

Co-authored-by: Schiano-NOAA <[email protected]>

* Add nmfspalette back into package

* Merge newer dev branch into old (#148)

* Minor grammatical changes just to set up new dev-1.1 branch (changed quarto --> Quarto)

* Feat(vignettes):
-added tables of contents to vignettes
-added tip for how to edit rda files to a11y vignette
-added link to faqs vignette to a11y vignette re: how to edit alt text and captions

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>

* rebase NAMESPACE

* remove old package from namespace and add in new

* add notes for new alttext test

* Removed captions_alt_text_template.csv because it's not used in asar... only satf. Then updated a11y vignette to reflect where users should look for the file.

* Remove nmfspallete from dependencies temporarily (#139)

* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests

* Add nmfspalette back into package

* feature(alter accessibility fxns): split up funxtion into two and called both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly

* Remove nmfspallete from dependencies temporarily (#139)

* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests

* Add nmfspalette back into package

* update(create_template): custom_sections adds all selected plus refs, acknow, and tables and figs if desired

* add spp_conout.csv to gitignore during testing

* feature(add_alttext): add accessibility for user to add alt text to figures inserted into the outline (png)

* fix(add_alttext): improve fxning for adding alt text to custom figs either from images or code chunks

* feature(add_alttext): add example to function

* Update documentation

* comment out alttext fxn test

* clean up fxns and add examples

* add in support_file/accessibilit.tex

* fix(create_tables_doc): remove incorrect and duplicate indices table code

* update(accessibility fxns): update to fix minor issues with functions and documentation as mentioned by @sbreitbart-NOAA

* update documentation

* update(test-alttext): change test for alttext to mimic changes to the function - sdoes not work still

* update(a11y fxns): improvements to functions as well as tests

* fix documentation for fxns

* update documentation

* update(add_alttext): update example to show to to use rename arg

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>
Schiano-NOAA added a commit that referenced this pull request Feb 24, 2025
* Feat(vignettes):
-added tables of contents to vignettes
-added tip for how to edit rda files to a11y vignette
-added link to faqs vignette to a11y vignette re: how to edit alt text and captions

* fix to incorrect reference in .bib file (#149)

* fix incorrect reference

* add url to reference fix

* remove replicate nmfs palette and add_theme

* remove files

* Custom template fixes (#143)

* update(create_template): comment out skeleton pop up at the end

* update(add_section): add functionality for putting new subsection into section

* Update(add_section): fix pathing for locating section to place code and change from add_chunk to add_child

* update(create_template): select only custom_sections when user wants to make a different outline of report

custom must = TRUE otherwise copies all files

* Fix(create_template): adjust if statement argument for custom_sections

* Add nmfspalette package back in

* removed add_theme and associated test and documentation

* remove static NOAA Fishies in authorship

* update NOAA fisheries affiliations

Co-authored-by: Schiano-NOAA <[email protected]>

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>

* Fix(create_template):
-Fix so that rda files can be added as input, if already created, OR generated if model results are included as an argument.
-Update documentation

* update(format_quarto): add functionality for html formatting with associated files and changes to create_template (#152)

* small comment update

* update(create_template): custom_sections adds all selected plus refs, acknow, and tables and figs if desired

* Custom template fixes (#143)

* update(create_template): comment out skeleton pop up at the end

* update(add_section): add functionality for putting new subsection into section

* Update(add_section): fix pathing for locating section to place code and change from add_chunk to add_child

* update(create_template): select only custom_sections when user wants to make a different outline of report

custom must = TRUE otherwise copies all files

* Fix(create_template): adjust if statement argument for custom_sections

* Add nmfspalette package back in

* removed add_theme and associated test and documentation

* remove static NOAA Fishies in authorship

* update NOAA fisheries affiliations

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>

* Inject accessibility (#124)

* Custom template fixes (#143)

* update(create_template): comment out skeleton pop up at the end

* update(add_section): add functionality for putting new subsection into section

* Update(add_section): fix pathing for locating section to place code and change from add_chunk to add_child

* update(create_template): select only custom_sections when user wants to make a different outline of report

custom must = TRUE otherwise copies all files

* Fix(create_template): adjust if statement argument for custom_sections



* Removed captions_alt_text_template.csv because it's not used in asar... only satf. Then updated a11y vignette to reflect where users should look for the file.

* changed eval for first chunk to true, and eval for indices table setup chunk to false, re: #102 . Will change eval to true for all chunks once indices table fxn is completed.

* feature(add new template partial for accessibility and add fxn)

* Update(add_tagging): ability to add alternative text to tex file from rdas

* fix(add_taggig): change directory for rda files to arg

* fix(add_tagging): change pathing to rda_dir

* fix(add-tagging): rename accessibility tex for output

* feature(add_accessibility): rename function and load documentation

* Initial commit for add_accessibility test - commented out bc unfinished

* update(test-add_accessibility): add snapshot for tex file and add proper code for testing

* feature(alter accessibility fxns): split up funxtion into two and called both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly

* Remove nmfspallete from dependencies temporarily (#139)

* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests

* style and docs: run devtools::document() and styler::style_pkg() (#140)

Co-authored-by: Schiano-NOAA <[email protected]>

* Add nmfspalette back into package

* Merge newer dev branch into old (#148)

* Minor grammatical changes just to set up new dev-1.1 branch (changed quarto --> Quarto)

* Feat(vignettes):
-added tables of contents to vignettes
-added tip for how to edit rda files to a11y vignette
-added link to faqs vignette to a11y vignette re: how to edit alt text and captions

* remove old package from namespace and add in new

* add notes for new alttext test

* Removed captions_alt_text_template.csv because it's not used in asar... only satf. Then updated a11y vignette to reflect where users should look for the file.

* feature(alter accessibility fxns): split up funxtion into two and called both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly

* update(create_template): custom_sections adds all selected plus refs, acknow, and tables and figs if desired

* add spp_conout.csv to gitignore during testing

* feature(add_alttext): add accessibility for user to add alt text to figures inserted into the outline (png)

* fix(add_alttext): improve fxning for adding alt text to custom figs either from images or code chunks

* feature(add_alttext): add example to function

* comment out alttext fxn test

* clean up fxns and add examples

* add in support_file/accessibilit.tex

* fix(create_tables_doc): remove incorrect and duplicate indices table code

* update(accessibility fxns): update to fix minor issues with functions and documentation as mentioned by @sbreitbart-NOAA

* update documentation

* update(test-alttext): change test for alttext to mimic changes to the function - sdoes not work still

* update(a11y fxns): improvements to functions as well as tests

* update(add_alttext): update example to show to to use rename arg

* minor updates and changes to fix test failures and checks

* Feat(create_tables_doc): automatically test if tables are wide enough to require changing page orientation from portrait to landscape. Alter the Tables qmd to allow orientation changes for each table, if necessary.

* Update orientation-related code for still-in-dev landings table

* Extend landscape table width from 7.5 to 8.5"; add page breaks between tables

* bug fixes

* Started coding new function to handle super wide tables and split into smaller ones

* Finished first full draft of function that will render large tables by splitting into multiple tables

* Added essential_columns arg to render_lg_table()

* Move orientation-detecting code into own function in utils, then update create_tables_doc

* Moved render_lg_table fxn to own R script, then updated documentation

* Update tests to remove temporary files upon test completion

* Add more params to render_lg_table() and ID_pg_orientation(), then update documentation and usage in create_tables_doc()

* Added code into create_tables_doc that splits extra-wide tables into multiple smaller tables, but still a bug in render_lg_table (producing "Error" as part of output when testing)

* Found a solution for sourcing render_lg_table in 08_tables.qmd and successfully rendering extra-wide table with new solution, but need to check if this will work in other circumstances

* found a successful workflow and applied it to indices table. Next step: apply to other tables, and simplify/clarify the new functions

* Copied new changes to bnc table, but referencing a chunk with multiple tables will only reference the last table in the chunk, not the first. So next step: make a chunk for each table.
Also removed now irrelevant function: ID_split_tbls

* Redesigned create_tables_doc so that each table has its own chunk and can be referenced.

* Updated landings table code

* Removed "-plot" from create_figures/tables_doc chunks

* Add note to create_tables_doc explaining why new rda with split tables is made; update documentation

* First draft of render_lg_table test; update documentation

* Remove code from create_tables_doc that reduces row height in tables

* update terminal sb naming to match other conventions

* Added Q&A about figure/table order to FAQs vignette

* Updated create_tables_doc so that split tables include header values in parentheses after caption (example: <indices caption> (Fleet 6, Fleet 7))

* Updated examples

* Clarified comments; renamed some variables to be unique and more clear; removed unnecessary and repetitious code

* Add vignette for convert_output fxn (#161)

* feature(convert output vignette): initial commit for article describing the convert output function

* feature(conout vignette): add in more information including example dataframe (needs adjustment to code chunk)

* minor improvements to convert_output vignette

* update(convert output vignette): add links to function and parts of code; add useful functions outside of asar used in function

* finish(convert output vignette): add in flowchart and final details

* add(conout-vignette): update chunk displatying example data

* Update vignettes/convert_output_details.Rmd

Co-authored-by: Sophie Breitbart <[email protected]>

* Update vignettes/convert_output_details.Rmd

Co-authored-by: Sophie Breitbart <[email protected]>

* Update vignettes/convert_output_details.Rmd

Co-authored-by: Sophie Breitbart <[email protected]>

* Update vignettes/convert_output_details.Rmd

Co-authored-by: Sophie Breitbart <[email protected]>

* fix(conout vignette): clarity to the text per comments made from @sbreitbart-NOAA

* update(conout vignette): add finishing touches to convert output vignette

* Fix translation of R0 parameter from BAM in convert_output (#163)

* fix(convert_output): fix error when parameters containing a number were incorrectly labelled in the final df

* First full draft of vignette re: #156

* fix(dev): remove add_accessibility and add_tagging functions since they are still in development until we can make the change to work alt text and tagging together

* Converting vignette's option comparison table to flextable

* update(add_alttext): change search name for figures to reflect change to rendering naming convention

* update(add_alttext): additional line to find old naming conventions from figures processed from quarto

* note(add_alttext): add TODO in fxn for rendering to html or docx if applicable down the line

---------

Co-authored-by: sbreitbart-NOAA <[email protected]>
Co-authored-by: Ian Taylor <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <[email protected]>
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.

Improve accessibility of documents by adding alternative text, tagging systems, and defining acronyms
2 participants