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

DOI handling on the DESCRIPTION file docs #1321

Open
dieghernan opened this issue Apr 6, 2022 · 4 comments
Open

DOI handling on the DESCRIPTION file docs #1321

dieghernan opened this issue Apr 6, 2022 · 4 comments
Labels
reprex needs a minimal reproducible example

Comments

@dieghernan
Copy link
Contributor

dieghernan commented Apr 6, 2022

Related to #1164 and after #1315 (also check #1265 for reference).

I found that (non) encoding DOIs when parsing the url of the Description field (DESCRIPTION file) may be an issue. On the specific case presented on #1164 (DOIs with angle brackets) the following string on the Description:

<doi:10.1175/1520-0469(1996)053%3C2365:PORWON%3E2.0.CO;2>

is parsed to

\doi{10.1175/1520-0469(1996)053\%3C2365:PORWON\%3E2.0.CO;2}

When I run devtools::check(cran = TRUE, remote = TRUE) I got:

> devtools::check(cran = TRUE, remote = TRUE)
ℹ Updating testroxy documentation
ℹ Loading testroxy
── Building ───────────────────────────────────────────────────── testroxy ──
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
─────────────────────────────────────────────────────────────────────────────
✓  checking for file ‘/cloud/project/DESCRIPTION’ ...
─  preparing ‘testroxy’:
✓  checking DESCRIPTION meta-information ...
   Warning: newline within quoted string at testroxy-package.Rd:9
   Error in parse_Rd("/tmp/RtmpQO2rQN/Rbuild3a6466c2d1f/testroxy/man/testroxy-package.Rd",  : 
     Unexpected end of input (in " quoted string opened at testroxy-package.Rd:9:727)
   Execution halted
Error in (function (command = NULL, args = character(), error_on_status = TRUE,  : 
  System command 'R' failed, exit status: 1, stdout & stderr were printed
Type .Last.error.trace to see where the error occurred
> 
@hadley
Copy link
Member

hadley commented Jun 24, 2022

Could you please create a simple reprex illustrating the lack-of-escaping problem?

@hadley hadley added the reprex needs a minimal reproducible example label Jun 24, 2022
@dieghernan
Copy link
Contributor Author

Hope this is good enough for illustrating the issue:

# Create a new package on tempdir()
# usethis::create_package(path = tempdir())

usethis::use_description(
  fields = list(
    Description =
      "A test on roxygen2 <doi:10.1175/1520-0469(1996)053%3C2365:PORWON%3E2.0.CO;2>"
  ),
  roxygen = TRUE
)

usethis::use_package_doc()
roxygen2::roxygenise()

devtools::check()

Gives:


> devtools::check()
i Updating RtmpmMBGwp documentation
i Loading RtmpmMBGwp
-- Building ----------------------------------------------------------- RtmpmMBGwp --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
* CXX14FLAGS: -Wall -pedantic
* CXX17FLAGS: -Wall -pedantic
* CXX20FLAGS: -Wall -pedantic
-------------------------------------------------------------------------------------
v  checking for file 'C:\Users\xxxx\AppData\Local\Temp\RtmpmMBGwp/DESCRIPTION' (475ms)
-  preparing 'RtmpmMBGwp':
v  checking DESCRIPTION meta-information ... 
   Warning: newline within quoted string at RtmpmMBGwp-package.Rd:9
   Error in parse_Rd("C:/Users/q31407/AppData/Local/Temp/RtmpqKFcOF/Rbuild2dd47aac10bd/RtmpmMBGwp/man/RtmpmMBGwp-package.Rd",  : 
     Unexpected end of input (in " quoted string opened at RtmpmMBGwp-package.Rd:9:79)
   Ejecución interrumpida
Error in c("(function (command = NULL, args = character(), error_on_status = TRUE, ",  : 
  ! System command 'Rcmd.exe' failed
Type .Last.error.trace to see where the error occurred

@remlapmot
Copy link

I have had this problem and solved it by converting such DOIs to short DOI URLs using the shortDOI Service

https://shortdoi.org/

That service shortens yours to: 10/bd3z9x i.e., \doi{10/bd3z9x} and I think you can drop the 10/ prefix as well to \doi{bd3z9x} as they also give the URL as https://doi.org/bd3z9x .

@hadley
Copy link
Member

hadley commented Jun 24, 2022

I was thinking you could make an even simpler reprex with package_url_parse()? That's where the problem lies, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

3 participants