-
Notifications
You must be signed in to change notification settings - Fork 214
Gt Word escaping potentially invalid chars #1016
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
Gt Word escaping potentially invalid chars #1016
Conversation
…ne at the bottom row
add explicit usage of htmltools::htmlEscape
Hey @rich-iannone , I'd appreciate your thoughts on using htmlEscape vs a more targeted solution |
@thebioengineer I think using I've lightly re-styled the .R file and merged in the dev branch. However, from that, a test is failing. On my machine, anyway. Could you pull from the changes here, make some manual tests, and fix if necessary? Seems fine on CI so I wonder if one of my packages is out of date. (I'll keep trying to figure this out in the meantime.) |
I think you are getting a failing test locally but not on CI because there are skips of tests on CI and CRAN, but not locally. There is now a bug in that because cells have footnote tags added before they are processed by |
I had an idea...there is the |
Nice! I'll check out the branch and test locally here as well. |
Perhaps it hasn't been addressed yet (or maybe it's different on your system) but I get a test error with this statement (line 749 of expect_equal(
docx_table_body_header %>%
xml2::xml_find_all(".//w:p") %>%
xml2::xml_text(),
c(
"numtrue1false", "chartrue2false", "fctr", "date", "time",
"datetime", "currency", "row", "group"
)
) Error output is:
|
Yes, this should be addressed now...it was because of htmlEscape being applied at the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Summary
Thank you for contributing to gt! To make this process easier for everyone, please explain the context and purpose of your contribution. Also, list the changes made to the existing code or documentation.
I found that if there were carrots (>,<) in the text of cells, it would cause the document not to render correctly. Adding this in escapes this and other potentially impactful symbols using htmltools::htmlEscape. If you can come up with something else I am all ears, because this will prevent people from passing their own valid ooxml code through gt to word.
Also realized the code to add a summary rows added the bottom row lines after the first row.
Related GitHub Issues and PRs
Checklist
testthat
unit tests totests/testthat
for any new functionality.