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

Open
wants to merge 50 commits into
base: dev
Choose a base branch
from
Open

Inject accessibility #124

wants to merge 50 commits into from

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!

…led both using the add_accessibility function

Also adjusted testing function for add_alttext and removed old snapshot - was not working properly
@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 and others added 24 commits January 21, 2025 14:58
-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
…ociated files and changes to create_template (#152)
….. only satf. Then updated a11y vignette to reflect where users should look for the file.
* Remove nmfs-pallete from dependencies temporarily

* Comment out reference to nmfs pallete in add_theme and tests
* 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]>
* 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]>
…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
@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?

@@ -8,11 +8,11 @@
#' @param compile TRUE/FALSE - indicate whether the document (X) should be rendered after these files are changed
#' @param rename change the name of the latex file for final compilation or saving
#'
#' @return DRAFT: This function was made to help add in latex packages and content
#' associated with PDF tagging. Quarto does not allow the user to edit anything
#' before documentclass, so this function alters the rendered .tex file. Users
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please clarify what these arguments mean and what they could look like. I had to look into the source code to figure out what some of the args were actually asking for. For instance, alttext_csv_dir requires a directory + the csv name, whereas the other dir-related args (dir, rda_dir) only require a directory. Similarly, I wasn't sure if rename required ".tex" or not. So, I'd make the following changes:

  1. Change dir to tex_dir, for clarity
  2. Change the arg alttext_csv_dir to alttext_csv
  3. Change the alttext_csv arg definition to state that this references the location of the alt text csv
  4. Update the rename definition to specify that this new name shouldn't include the .tex filetype
  5. Add the default value of compile to its definition
  6. Update the x definition to specify that this is the .tex file into which alt text, not "accessibility", is added
  7. Make the "X" within the compile doc lowercase to match the x argument

R/add_alttext.r Outdated
#'
#' @inheritParams add_accessibility
#'
#' @return DRAFT: This function was made to help add in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still a draft?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is and is outdated somehow after your review which makes no sense because I pushed all of these changes on tuesday

R/add_accessibility.R Outdated Show resolved Hide resolved
R/add_tagging.r Outdated
#'
#' @inheritParams add_accessibility
#'
#' @return DRAFT: This function was made to help add in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still a draft? (for this and the other 2 identical comments, please remove "DRAFT: " if it's ready to merge)

@@ -0,0 +1,122 @@
#' Add alternative text into latex
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: please change the filetype from .r to .R for consistency

@@ -0,0 +1,56 @@
#' Add tagging structure to latex documents produced from quarto
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: please change the filetype from .r to .R for consistency

#' function as a way to add alternative text to all
#' figures, please leave an issue to request this function.
#'
#' @export
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add examples if they're absent (I can see an example in Rstudio but not here... ?), and update the example to include the alttext_csv_dir and rename args.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added on tuesday...not sure why none of my changes are there. Git is telling me that everything is updated

#' @return DRAFT: This function was made to help add in
#' latex packages and content associated with PDF
#' tagging. Quarto does not allow the user to edit anything
#' before documentclass, so this function alters the rendered .tex file.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also don't see the example here, but I do see it in my Rstudio file ...? Please update the example to include the fxn's rename arg (currently includes rda_dir instead, which isn't an add_tagging() arg)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ditto above

Copy link
Collaborator

Choose a reason for hiding this comment

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

This function isn't working for me. I'm using the same args as for add_tagging and add_alttext, but I get an error I think is about incorrect filepaths ("Error in file(file, "rt") : cannot open the connection"). The error arises at line 73, when add_alttext is called.

@@ -1,10 +1,12 @@
# Generated by roxygen2: do not edit by hand
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, meant to mention this: Initially, I had some issues rendering the 08_tables.qmd. Based on conversations from a couple of weeks ago, I'm sure this will be resolved with rebasing (these errors arose for you before, I believe, as explained here: #153 )

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
3 participants