Convert Among Citation Formats

Converts among many citation formats, including 'BibTeX', 'Citeproc', 'Codemeta', 'RDF XML', 'RIS', 'Schema.org', and 'Citation File Format'. A low level 'R6' class is provided, as well as stand-alone functions for each citation format for both read and write.


Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status Build status codecov.io

a tool for converting among citation formats.

heavily influenced by, and code ported from https://github.com/datacite/bolognese

supported readers:

supported writers:

not supported yet, but plan to:

  • crosscite

stable version

install.packages("handlr")

dev version

devtools::install_github("ropensci/handlr")
library("handlr")

All in one

There's a single R6 interface to all readers and writers

z <- system.file("extdata/citeproc.json", package = "handlr")
x <- HandlrClient$new(x = z)
x
#> <handlr> 
#>   doi: 
#>   ext: json
#>   format (guessed): citeproc
#>   path: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/handlr/extdata/citeproc.json
#>   string (abbrev.): none

read the file

x$read(format = "citeproc")

the parsed content

x$parsed
#> $id
#> [1] "https://doi.org/10.5438/4k3m-nyvg"
#> 
#> $type
#> [1] "BlogPosting"
#> 
#> $additional_type
#> NULL
#> 
#> $citeproc_type
#> [1] "post-weblog"
#> 
#> $bibtex_type
#> [1] "article"
#> 
#> $ris_type
#> [1] "GEN"
#> 
#> $doi
#> [1] "10.5438/4k3m-nyvg"
...

write out bibtex

cat(x$write("bibtex"), sep = "\n")
#> @article{https://doi.org/10.5438/4k3m-nyvg,
#>   doi = {10.5438/4k3m-nyvg},
#>   author = {Martin Fenner},
#>   title = {Eating your own Dog Food},
#>   journal = {DataCite Blog},
#>   pages = {},
#>   publisher = {DataCite},
#>   year = {2016},
#> }

Choose your own adventure

Instead of using the HandlrClient, you can use the regular functions for each reader or writer. They are:

  • citeproc_reader() / citeproc_writer()
  • ris_reader() / ris_writer()
  • bibtex_reader() / bibtex_writer()
  • codemeta_reader() / codemeta_writer()
  • schema_org_writer()
  • rdf_xml_writer()

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for handlr in R doing citation(package = 'handlr')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

ropensci_footer

News

handlr 0.1.0

NEW FEATURES

  • Released to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("handlr")

0.3.0 by Scott Chamberlain, 6 days ago


https://github.com/ropensci/handlr (devel), https://docs.ropensci.org/handlr/ (docs)


Report a bug at https://github.com/ropensci/handlr/issues


Browse source code at https://github.com/cran/handlr


Authors: Scott Chamberlain [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports jsonlite, crul, xml2, urltools, mime, yaml

Suggests testthat, jsonld, data.table, bibtex


Suggested by rorcid.


See at CRAN