GeoBosh / Rdpack

R package Rdpack provides functions and macros facilitating writing and management of R documentation.
https://geobosh.github.io/Rdpack/
28 stars 6 forks source link

Missing new line in references with `\insertAllCited{}` #9

Closed aravind-j closed 5 years ago

aravind-j commented 5 years ago

Line breaks between multiple references are missing in html documentation, when \insertAllCited{} is used. However, the line breaks appear in pdf documentation.

For example in germinationmetrics html

Rdpack::viewRd("./man/CUGerm.Rd", type = "html")
Rdpack::viewRd("./man/FirstGermTime.Rd", type = "html")

pdf https://github.com/aravind-j/germinationmetrics/blob/master/germinationmetrics.pdf (Page 3-5)

GeoBosh commented 5 years ago

Thanks for the report. I am not able to reproduce this on my system - in html the entries are enclosed in <p> tags and appear on new lines. Besides your examples, I tried also

help(CUGerm, help_type = "html")

which also is ok. Which version of Rdpack are you running?

aravind-j commented 5 years ago

It is Rdpack_0.10-2

sessionInfo()
R Under development (unstable) (2018-10-21 r75476)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252   
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C                  
[5] LC_TIME=English_India.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] germinationmetrics_0.1.1.9000

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19      plyr_1.8.4        compiler_3.6.0    pillar_1.3.0     
 [5] bindr_0.1.1       prettyunits_1.0.2 base64enc_0.1-3   remotes_2.0.1    
 [9] tools_3.6.0       testthat_2.0.1    digest_0.6.18     pkgbuild_1.0.2   
[13] pkgload_1.0.1     gtable_0.2.0      lattice_0.20-35   nlme_3.1-137     
[17] memoise_1.1.0     tibble_1.4.2      debugme_1.1.0     pkgconfig_2.0.2  
[21] rlang_0.3.0       bibtex_0.4.2      cli_1.0.1         rstudioapi_0.8   
[25] ggrepel_0.8.0     yaml_2.2.0        bindrcpp_0.2.2    stringr_1.3.1    
[29] withr_2.1.2       dplyr_0.7.7       desc_1.2.0        fs_1.2.6         
[33] devtools_2.0.0    gbRd_0.4-11       grid_3.6.0        rprojroot_1.3-2  
[37] tidyselect_0.2.5  glue_1.3.0        R6_2.3.0          processx_3.2.0   
[41] Rdpack_0.10-2     minpack.lm_1.2-1  sessioninfo_1.1.0 ggplot2_3.0.0    
[45] tidyr_0.8.1       callr_3.0.0       purrr_0.2.5       magrittr_1.5     
[49] scales_1.0.0      backports_1.1.2   ps_1.2.0          usethis_1.4.0    
[53] assertthat_0.2.0  colorspace_1.3-2  stringi_1.2.4     lazyeval_0.2.1   
[57] munsell_0.5.0     broom_0.5.0       crayon_1.3.4 

The html entries appear as follows

<p>Bewley JD, Black M (1994).
<em>Seeds: Physiology of Development and Germination.</em>.
Plenum Publishing Corporation, New York, USA.
ISBN 0-306-44748-7.

Heydecker W (1972).
<em>Seed Ecology. Proceedings of the Nineteenth Easter School in Agricultural Science, University of Nottingham, 1972</em>.
Pennsylvania State University Press, University Park, USA.
</p>

So the output is: Bewley JD, Black M (1994). Seeds: Physiology of Development and Germination.. Plenum Publishing Corporation, New York, USA. ISBN 0-306-44748-7. Heydecker W (1972). Seed Ecology. Proceedings of the Nineteenth Easter School in Agricultural Science, University of Nottingham, 1972. Pennsylvania State University Press, University Park, USA.

The package binary with the generated html is at https://github.com/aravind-j/germinationmetrics/blob/master/germinationmetrics_0.1.1.9000.zip

GeoBosh commented 5 years ago

I will investigate further what's wrong here. Your package builds successfully (in the sense it doesn't show this problem) with both the development version and 3.5.1 of R. It is true that my R-devel is from 2018-10-02, so I will update my installation and check with a more current R-devel.

There is a slight possibility that a mismatched ./build/partial.rdb in the source directory of your package might have something to do with this. (It is created by R CMD during installation.)
An easy check for this is to delete ./build and rebuild the package.

Thanks again for the complete report.

GeoBosh commented 5 years ago

I don't get the issue with the latest R-devel for Windows (2018-10-27 r75507). I have put the build at https://github.com/GeoBosh/germinationmetrics/blob/master/germinationmetrics_0.1.1.9000.zip (my fork is somewhat behind your branch).

aravind-j commented 5 years ago

Your fork of germinationmetrics has the references inserted using \insertRef{}, while I have replaced it with \insertAllCited{} for R/CUGerm.R and R/FirstGermTime.R. Probably this is why issue could not be reproduced.

With \insertRef{}, there was no issue. I was replacing them with in line citations and \insertAllCited{} before a new submission to CRAN when I noticed this issue.

Meanwhile I will also try with the latest R-devel and keep you posted.

aravind-j commented 5 years ago

Issue still persists with R-devel for Windows (2018-10-27 r75507)

GeoBosh commented 5 years ago

I can confirm that when building germinationmetrics from your current master, I get the issue (I should have done this straightaway).

GeoBosh commented 5 years ago

Summary up to now (please correct me if I am wrong):

  1. I reproduced the issue with R-devel (2018-10-27) and an earlier one (2018-10-02).

  2. If the package is build with 3.5.1patched the issue does not appear when the tarball is used to install the package for 3.5.1patched and R-devel (including the above mentioned versions).

This may be related to a recent change in R-devel (mentioned in NEWS.R-devel.html), concerning the format of saving ‘partial.rdb’ generated by R CMD build.

I uploaded Rdpack v. 0.10-3 on github which hopefully fixes the problem. Not tested extensively yet, but Rdpack itself and germinationmetrics seem ok.

Further insight and corrections are welcome.

aravind-j commented 5 years ago

Yes, on my end too, it seems to be fixed with Rdpack v. 0.10-3.

GeoBosh commented 5 years ago

The fix in Rdpack 10.3 uses line breaks instead of paragraph breaks. I find this somewhat suboptimal but I will carry this fix in the next release of Rdpack since correcting this minor issue is not a high priority for R core, see also http://r.789695.n4.nabble.com/disappearing-paragraphs-in-html-rendering-of-text-from-Rd-macros-td4753409.html#a4753435. Moreover, this fix resolves a similar issue in pkgdown, see r-lib/pkgdown#819.