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

Change to webshot2 to support special characters in key #58

Open
LukasWallrich opened this issue Dec 11, 2022 · 0 comments
Open

Change to webshot2 to support special characters in key #58

LukasWallrich opened this issue Dec 11, 2022 · 0 comments

Comments

@LukasWallrich
Copy link
Contributor

Currently, export_as = "png") fails when the keys (and thus file-names) contain characters that need to be escaped in HTML. For instance:

library(namedropR)
drop_name_crossref("https://doi.org/10.1037/bul0000315", export_as = "png")
#> No cite_key specified. Working through all possible 1 entries in the bibliography.
#> Could not load  file:///private/var/folders/xk/g0cqx1hs53z_txqsyq74jzcc0000gn/T/RtmpxTyQg9/reprex-9e542a3778c7-hexed-tuna/visual_citations/G%EF%BF%BDtz_2020.html
#> Could not take a screenshot of the intermediate HTML.
#> <simpleError in webshot::webshot(output_file, paste0(output_file, ".png"), selector = ".visual-citation",     zoom = 2): webshot.js returned failure value: 1>
#> [1] "visual_citations/Götz_2020.html.png"

This is because phantomjs converts URLs and escapes special characters. Since that is not really a bug, I'm not very optimistic that we can get that changed - so I would suggest changing to (webshot2)[] which intends to supersede webshot, is better supported and does not struggle with this case.

library(webshot2)
file1 <- "Götz_2020.html"

writeLines("<html><body>hello world!</body></html>", file1)

webshot(file1)

Created on 2022-12-11 with reprex v2.0.2

This was referenced Dec 11, 2022
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

No branches or pull requests

1 participant