Skip to content

Commit

Permalink
remove output.lines thing in readme, not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jan 21, 2020
1 parent 6f7d185 commit 9344804
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 55 deletions.
27 changes: 1 addition & 26 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@ handlr
======

```{r echo=FALSE}
library("knitr")
hook_output <- knitr::knit_hooks$get("output")
knitr::knit_hooks$set(output = function(x, options) {
lines <- options$output.lines
if (is.null(lines)) {
return(hook_output(x, options)) # pass to default hook
}
x <- unlist(strsplit(x, "\n"))
more <- "..."
if (length(lines)==1) { # first n lines
if (length(x) > lines) {
# truncate the output, but add ....
x <- c(head(x, lines), more)
}
} else {
x <- c(if (abs(lines[1])>1) more else NULL,
x[lines],
if (length(x)>lines[abs(length(lines))]) more else NULL
)
}
# paste these lines together
x <- paste(c(x, ""), collapse = "\n")
hook_output(x, options)
})
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
Expand Down Expand Up @@ -103,7 +78,7 @@ x$read(format = "citeproc")

the parsed content

```{r output.lines=1:20}
```{r}
x$parsed
```

Expand Down
38 changes: 9 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ devtools::install_github("ropensci/handlr")

```r
library("handlr")
#> Registered S3 method overwritten by 'crul':
#> method from
#> as.character.form_file httr
```

## All in one
Expand Down Expand Up @@ -95,20 +92,6 @@ x$parsed
#> count: 1
#> first 10
#> id/doi: https://doi.org/10.5438/4k3m-nyvg
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
```

write out bibtex
Expand Down Expand Up @@ -146,18 +129,15 @@ reader or writer. They are:
z <- system.file('extdata/bib-many.bib', package = "handlr")
res2 <- bibtex_reader(x = z)
handl_to_df(res2)
#> key id type
#> 1 Amano_2016 https://doi.org/10.1093%2fbiosci%2fbiw022 article
#> 2 Bachelot_2016 https://doi.org/10.1890%2f15-1397.1 article
#> bibtex_type citeproc_type ris_type resource_type_general
#> 1 article article-journal JOUR <NA>
#> 2 article article-journal JOUR <NA>
#> additional_type doi
#> 1 JournalArticle 10.1093/biosci/biw022
#> 2 JournalArticle 10.1890/15-1397.1
#> b_url
#> 1 http://dx.doi.org/10.1093/biosci/biw022
#> 2 http://dx.doi.org/10.1890/15-1397.1
#> key id type bibtex_type
#> 1 Amano_2016 https://doi.org/10.1093%2fbiosci%2fbiw022 article article
#> 2 Bachelot_2016 https://doi.org/10.1890%2f15-1397.1 article article
#> citeproc_type ris_type resource_type_general additional_type
#> 1 article-journal JOUR <NA> JournalArticle
#> 2 article-journal JOUR <NA> JournalArticle
#> doi b_url
#> 1 10.1093/biosci/biw022 http://dx.doi.org/10.1093/biosci/biw022
#> 2 10.1890/15-1397.1 http://dx.doi.org/10.1890/15-1397.1
#> title
#> 1 Spatial Gaps in Global Biodiversity Information and the Role of Citizen Science
#> 2 Long-lasting effects of land use history on soil fungal communities in second-growth tropical rain forests
Expand Down

0 comments on commit 9344804

Please sign in to comment.