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

Default destination in cff_write_citation is in a temporary folder #78

Closed
roaldarbol opened this issue Aug 6, 2024 · 3 comments
Closed

Comments

@roaldarbol
Copy link

Hi there, thanks for this package!

I was walking through #51 to generate a inst/CITATION file, and it's mention in #51 (comment) that the default location is inst/CITATION, but it seems the default actually is a temporary folder. Is that a bug or a feature? I think the mentioned default makes a lot of sense, as that's exactly where you'd expect it to end up. :-)

> cff_write_citation(cff_obj)
ℹ Writing 2 entries ...Results written to /var/folders/rh/y9ws4bgj7x50twypcwtk2ypr0000gp/T//Rtmp8cLQvY/CITATION_6d794bd1d97
@roaldarbol
Copy link
Author

As an aside, it seems that saving it as inst/CITATION creates the cff format, whereas inst/CITATION_ creates the correct bibentry format - however, that file is not being picked up by citation() so the filename has to be manually edited afterwards.

@dieghernan
Copy link
Member

Is that a bug or a feature?

It is a feature, so I prefer no to mess around with files other than cff with this package (see also #79 (comment))

As an aside, it seems that saving it as inst/CITATION creates the cff format, whereas inst/CITATION_ creates the correct bibentry format - however, that file is not being picked up by citation() so the filename has to be manually edited afterwards.

Don't see the issue, just call cffr::cff_write_citation(x, "inst/CITATION") :

x <- cffr::cff_create("jsonlite")

cffr::cff_write_citation(x, "inst/CITATION")
#> ℹ Creating directory 'inst'
#> ℹ Writing 2 entries ...
#> ✔ Results written to 'inst/CITATION'

readLines("inst/CITATION")
#>  [1] ""                                                                                                              
#>  [2] "bibentry(bibtype = \"Article\","                                                                               
#>  [3] "         key = \"ooms:2014\","                                                                                 
#>  [4] "         title = \"The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects\","
#>  [5] "         author = person(given = \"Jeroen\","                                                                  
#>  [6] "                         family = \"Ooms\","                                                                   
#>  [7] "                         email = \"[email protected]\","                                                    
#>  [8] "                         comment = c(ORCID = \"0000-0002-4035-0289\")),"                                       
#>  [9] "         year = \"2014\","                                                                                     
#> [10] "         journal = \"arXiv:1403.2805 [stat.CO]\","                                                             
#> [11] "         url = \"https://arxiv.org/abs/1403.2805\")"
readCitationFile("inst/CITATION", meta = packageDescription("jsonlite"))
#> To cite package 'jsonlite' in publications use:
#> 
#>   Ooms J (2014). "The jsonlite Package: A Practical and Consistent
#>   Mapping Between JSON Data and R Objects." _arXiv:1403.2805
#>   [stat.CO]_. <https://arxiv.org/abs/1403.2805>.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Article{ooms:2014,
#>     title = {The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects},
#>     author = {Jeroen Ooms},
#>     year = {2014},
#>     journal = {arXiv:1403.2805 [stat.CO]},
#>     url = {https://arxiv.org/abs/1403.2805},
#>   }

Created on 2025-01-17 with reprex v2.1.1

@roaldarbol
Copy link
Author

No worries, I respect that stance completely. :-)
Then I do think adding an example in the documentation (an article) or a workflow of how to update the citations (both CITATION.cff and inst/CITATION) would be great. Even the function documentation doesn't include the example of actually writing the citation where it's expected (https://docs.ropensci.org/cffr/reference/cff_write_misc.html).

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

2 participants