Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dpprdan
Copy link
Contributor

@dpprdan dpprdan commented Feb 19, 2021

This adds a function with_pandoc_available() and runs url_check() with it. Closes #10.

with_pandoc_available() is slightly different from with_pandoc_path(). It first checks whether pandoc is on the PATH and only puts RStudio's pandoc on the PATH if it is not (assuming that users prefer to have the pandoc on the path that they deliberately installed over RStudio's). If neither is available, with_pandoc_available() throws an error.

with_pandoc_available() is then applied to url_db_from_package_sources() in url_check() (in order to fail early if pandoc is not available).

Side note: I don't quite understand the if(requireNamespace("xml2", quietly = TRUE)):

if(requireNamespace("xml2", quietly = TRUE)) {

if(requireNamespace("xml2", quietly = TRUE)) {

Can't this be ommitted? xml2 is in Imports, so it has to be available. If it wasn't, not all potential URL locations would be checked.

@jimhester
Copy link
Member

Most of the code in this package comes from the tools package and was deliberately not changed significantly except where needed to use from an R package. That is where the requireNamespace() calls are from and I would prefer to keep them.

Co-authored-by: Jim Hester <[email protected]>
@dpprdan
Copy link
Contributor Author

dpprdan commented Feb 23, 2021

Re: file.sep: Could it potentially be a problem that pandoc_path contains / and all paths in sys_path contain \\? (On Windows, obviously).

@dpprdan
Copy link
Contributor Author

dpprdan commented Feb 26, 2021

Most of the code in this package comes from the tools package

Apropos: IIUC there have been 4 commits to tools' urltools.R since you forked the code, one of which a patch from you.
Should https://github.com/r-lib/urlchecker/blob/master/R/urltools.R be kept in sync with https://github.com/wch/r-source/blob/trunk/src/library/tools/R/urltools.R?

@jimhester jimhester merged commit 0182a61 into r-lib:master Mar 2, 2021
@jimhester
Copy link
Member

Thanks!

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.

Put RStudio's Pandoc on the path during a check

2 participants