Skip to content

Commit

Permalink
move all egs and links from readme to vignette; rbuildignore vignette…
Browse files Browse the repository at this point in the history
… to avoid cran bullshit
  • Loading branch information
sckott committed Oct 14, 2020
1 parent 160e97a commit 1f1fa96
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 171 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ references.bib
citeproc_json_from_rorcid.json
appveyor.yml
^LICENSE\.md$
vignettes/handlr.Rmd
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ check_windows:

readme:
${RSCRIPT} -e "knitr::knit('README.Rmd')"

vign:
cd vignettes;\
${RSCRIPT} -e "Sys.setenv(NOT_CRAN='true'); knitr::knit('handlr.Rmd.og', output = 'handlr.Rmd')";\
cd ..
86 changes: 14 additions & 72 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ knitr::opts_chunk$set(

a tool for converting among citation formats.

heavily influenced by, and code ported from <https://github.com/datacite/bolognese>
heavily influenced by, and code ported from the Ruby gem `bolognese`

supported readers:

- [citeproc][]
- [ris][]
- [bibtex][] (requires suggested package `bibtex`)
- [codemeta][]
- [cff][]
- citeproc
- ris
- bibtex
- codemeta
- cff

supported writers:

- [citeproc][]
- [ris][]
- [bibtex][]
- [schema.org][]
- [rdfxml][] (requires suggested package [jsonld][])
- [codemeta][]
- [cff][]
- citeproc
- ris
- bibtex
- schemaorg
- rdfxml
- codemeta
- cff

not supported yet, but plan to:

Expand All @@ -57,58 +57,10 @@ dev version
remotes::install_github("ropensci/handlr")
```

```{r}
```{r eval=FALSE}
library("handlr")
```

## All in one

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

```{r}
z <- system.file("extdata/citeproc.json", package = "handlr")
x <- HandlrClient$new(x = z)
x
```

read the file

```{r}
x$read(format = "citeproc")
```

the parsed content

```{r}
x$parsed
```

write out bibtex

```{r}
cat(x$write("bibtex"), sep = "\n")
```

## 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()`

## Convert data to data.frame

```{r}
z <- system.file('extdata/bib-many.bib', package = "handlr")
res2 <- bibtex_reader(x = z)
handl_to_df(res2)
```

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/handlr/issues).
Expand All @@ -117,13 +69,3 @@ handl_to_df(res2)
* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)


[jsonld]: https://github.com/ropensci/jsonld/
[codemeta]: https://codemeta.github.io/
[citeproc]: https://en.wikipedia.org/wiki/CiteProc
[ris]: https://en.wikipedia.org/wiki/RIS_(file_format)
[bibtex]: http://www.bibtex.org/
[schema.org]: https://schema.org/
[rdfxml]: https://en.wikipedia.org/wiki/RDF/XML
[cff]: https://citation-file-format.github.io/
112 changes: 13 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ handlr

a tool for converting among citation formats.

heavily influenced by, and code ported from <https://github.com/datacite/bolognese>
heavily influenced by, and code ported from the Ruby gem `bolognese`

supported readers:

- [citeproc][]
- [ris][]
- [bibtex][] (requires suggested package `bibtex`)
- [codemeta][]
- [cff][]
- citeproc
- ris
- bibtex
- codemeta
- cff

supported writers:

- [citeproc][]
- [ris][]
- [bibtex][]
- [schema.org][]
- [rdfxml][] (requires suggested package [jsonld][])
- [codemeta][]
- [cff][]
- citeproc
- ris
- bibtex
- schemaorg
- rdfxml
- codemeta
- cff

not supported yet, but plan to:

Expand All @@ -58,82 +58,6 @@ remotes::install_github("ropensci/handlr")
library("handlr")
```

## All in one

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


```r
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/4.0/Resources/library/handlr/extdata/citeproc.json
#> string (abbrev.): none
```

read the file


```r
x$read(format = "citeproc")
```

the parsed content


```r
x$parsed
#> <handl>
#> from: citeproc
#> many: FALSE
#> count: 1
#> first 10
#> id/doi: https://doi.org/10.5438/4k3m-nyvg
```

write out bibtex


```r
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()`

## Convert data to data.frame


```r
z <- system.file('extdata/bib-many.bib', package = "handlr")
res2 <- bibtex_reader(x = z)
#> Error: Please install bibtex
handl_to_df(res2)
#> Error in assert(x, "handl"): object 'res2' not found
```

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/handlr/issues).
Expand All @@ -142,13 +66,3 @@ handl_to_df(res2)
* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)


[jsonld]: https://github.com/ropensci/jsonld/
[codemeta]: https://codemeta.github.io/
[citeproc]: https://en.wikipedia.org/wiki/CiteProc
[ris]: https://en.wikipedia.org/wiki/RIS_(file_format)
[bibtex]: http://www.bibtex.org/
[schema.org]: https://schema.org/
[rdfxml]: https://en.wikipedia.org/wiki/RDF/XML
[cff]: https://citation-file-format.github.io/
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
Loading

0 comments on commit 1f1fa96

Please sign in to comment.