Skip to content

Commit b48a84a

Browse files
authored
Merge pull request #36 from ropensci/rc_0_3_1
2 parents 94d2b7e + b344fdd commit b48a84a

34 files changed

+215
-182
lines changed

‎.Rbuildignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ citeproc_json_from_rorcid.json
1717
appveyor.yml
1818
^LICENSE\.md$
1919
vignettes/handlr.Rmd
20+
^CRAN-SUBMISSION$

‎CRAN-SUBMISSION‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Version: 0.3.1
2+
Date: 2025-03-03 19:19:14 UTC
3+
SHA: 49db50362a6ac3f96b7de40542cba633ea9edfc8

‎DESCRIPTION‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ Description: Converts among many citation formats, including 'BibTeX',
55
'Citation File Format'. A low level 'R6' class is provided, as well
66
as stand-alone functions for each citation format for both read
77
and write.
8-
Version: 0.3.0
8+
Version: 0.3.1
99
License: MIT + file LICENSE
1010
Authors@R: c(
11-
person("Scott", "Chamberlain", role = c("aut", "cre"),
11+
person("Scott", "Chamberlain", role = c("aut"),
1212
email = "[email protected]",
1313
comment = c(ORCID = "0000-0003-1444-9135")),
14+
person("Brenton M.", "Wiernik", role = c("aut", "cre"),
15+
email = "[email protected]",
16+
comment = c(ORCID = "0000-0001-9560-6336")),
1417
person("Thierry", "Onkelinx", email = "[email protected]", role = "ctb",
1518
comment = c(ORCID = "0000-0001-8804-4216"))
1619
)
17-
URL: https://github.com/ropensci/handlr (devel),
18-
https://docs.ropensci.org/handlr/ (docs)
20+
URL: https://github.com/ropensci/handlr, https://docs.ropensci.org/handlr/
1921
BugReports: https://github.com/ropensci/handlr/issues
2022
Roxygen: list(markdown = TRUE)
2123
Encoding: UTF-8
@@ -32,7 +34,7 @@ Suggests:
3234
jsonld,
3335
data.table,
3436
bibtex
35-
RoxygenNote: 7.1.2
37+
RoxygenNote: 7.3.2
3638
X-schema.org-applicationCategory: Metadata
3739
X-schema.org-keywords: doi, metadata, citation, bibtex, Crossref, Crosscite, Codemeta, RIS, Citeproc, RDF, XML, JSON
3840
X-schema.org-isPartOf: https://ropensci.org

‎NEWS.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
handlr 0.3.1
2+
============
3+
4+
### MINOR IMPROVEMENTS
5+
6+
* Update maintainer to Brenton M. Wiernik.
7+
* Improved support for Citation File Format (CFF) and codemeta.json
8+
9+
110
handlr 0.3.0
211
============
312

‎R/a_types.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#' cff references types
2-
#' @references http://bit.ly/2PRK1Vt
2+
#' @references https://bit.ly/2PRK1Vt
33
#' @details cff citation format types for references
44
#' @name cff_reference_types
55
#' @docType data

‎R/codemeta_writer.R‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#' codemeta writer
2-
#'
2+
#'
33
#' @export
44
#' @param z an object of class `handl`; see [handl] for more
5-
#' @param auto_unbox (logical) automatically "unbox" all atomic
5+
#' @param auto_unbox (logical) automatically "unbox" all atomic
66
#' vectors of length 1 (default: `TRUE`). passed to [jsonlite::toJSON()]
7-
#' @param pretty (logical) adds indentation whitespace to JSON output
7+
#' @param pretty (logical) adds indentation whitespace to JSON output
88
#' (default: `TRUE`), passed to [jsonlite::toJSON()]
99
#' @param ... further params passed to [jsonlite::toJSON()]
1010
#' @return an object of class `json`
@@ -16,8 +16,8 @@
1616
#' (z <- bibtex_reader(x))
1717
#' codemeta_writer(z)
1818
#' }
19-
#'
20-
#' # many citeproc to schema
19+
#'
20+
#' # many citeproc to schema
2121
#' z <- system.file('extdata/citeproc-many.json', package = "handlr")
2222
#' w <- citeproc_reader(x = z)
2323
#' codemeta_writer(w)
@@ -26,7 +26,7 @@ codemeta_writer <- function(z, auto_unbox = TRUE, pretty = TRUE, ...) {
2626
assert(z, "handl")
2727
stopifnot(length(z) > 0)
2828
w <- if (attr(z, "many") %||% FALSE) {
29-
lapply(z, codemeta_write_one)
29+
lapply(z, codemeta_write_one)
3030
} else {
3131
codemeta_write_one(z)
3232
}
@@ -42,7 +42,7 @@ codemeta_write_one <- function(z) {
4242
"codeRepository" = z$b_url,
4343
"title" = z$title,
4444
"agents" = z$author,
45-
"description" = parse_attributes(z$description,
45+
"description" = parse_attributes(z$description,
4646
content = "text", first = TRUE),
4747
"version" = z$software_version,
4848
# FIXME: not sure what's going on here
@@ -54,4 +54,4 @@ codemeta_write_one <- function(z) {
5454
))
5555
}
5656

57-
cm_urls <- c("http://purl.org/codemeta/2.0", "http://schema.org")
57+
cm_urls <- c("https://purl.org/codemeta/2.0", "https://schema.org")

‎R/doi_utils.R‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ doi_resolver <- "https://doi.org"
66
# validate_doi: should extract DOI if it's in a URL
77
# validate_doi(doi = "10.1371/journal.pone.0025995") # valid
88
# validate_doi(doi = "10/journal.pone.0025995") # invalid
9-
# validate_doi(doi = "http://dx.doi.org/10.5063/F1M61H5X") # valid url
10-
# validate_doi(doi = "http://dx.doi.org/30.5063/F1M61H5X") # invalid url
9+
# validate_doi(doi = "https://doi.org/10.5063/F1M61H5X") # valid url
10+
# validate_doi(doi = "https://doi.org/30.5063/F1M61H5X") # invalid url
1111
validate_doi <- function(doi) {
1212
# doi <- grep(doi_pattern, doi, perl = TRUE, value = TRUE)
1313
doi <- regmatches(doi, regexpr(doi_pattern, doi, perl=TRUE))
@@ -39,8 +39,8 @@ normalize_doi <- function(doi) {
3939
file.path(doi_resolver, doi_str)
4040
}
4141

42-
# is_url_doi("http://doi.org/10.1371/journal.pone.0025995")
43-
# doi_from_url(url = "http://doi.org/10.1371/journal.pone.0025995")
42+
# is_url_doi("https://doi.org/10.1371/journal.pone.0025995")
43+
# doi_from_url(url = "https://doi.org/10.1371/journal.pone.0025995")
4444
doi_from_url <- function(url) {
4545
if (is_url_doi(url)) {
4646
df <- urltools::url_parse(url)

‎R/handlr-package.r‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
#' **Citation format converter**
2-
#'
2+
#'
33
#' A tool for converting among citation formats
4-
#'
4+
#'
55
#' @section supported readers:
6-
#'
6+
#'
77
#' - citeproc
88
#' - ris
99
#' - bibtex (requires suggested package `bibtex`)
1010
#' - codemeta
1111
#' - cff
12-
#'
12+
#'
1313
#' @section supported writers:
14-
#'
14+
#'
1515
#' - citeproc
1616
#' - ris
1717
#' - bibtex
1818
#' - schema.org
1919
#' - rdfxml (requires suggested package `jsonld`)
2020
#' - codemeta
2121
#' - cff
22-
#'
22+
#'
2323
#' @section links for citation formats:
24-
#'
24+
#'
2525
#' - citeproc: <https://en.wikipedia.org/wiki/CiteProc>
2626
#' - codemeta: <https://codemeta.github.io/>
2727
#' - ris: <https://en.wikipedia.org/wiki/RIS_(file_format)>
28-
#' - bibtex: <http://www.bibtex.org/>
28+
#' - bibtex: <https://www.bibtex.org/>
2929
#' - schema.org: <https://schema.org/>
3030
#' - rdfxml: <https://en.wikipedia.org/wiki/RDF/XML>
3131
#' - cff: <https://citation-file-format.github.io/>
@@ -38,5 +38,5 @@
3838
#' @name handlr-package
3939
#' @aliases handlr
4040
#' @author Scott Chamberlain \email{sckott@@protonmail.com}
41-
#' @docType package
42-
NULL
41+
#' @keywords internal
42+
"_PACKAGE"

‎R/schema_org_writer.R‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#' Schema org writer
2-
#'
2+
#'
33
#' @export
44
#' @param z an object of class `handl`; see [handl] for more
5-
#' @param auto_unbox (logical) automatically "unbox" all atomic
5+
#' @param auto_unbox (logical) automatically "unbox" all atomic
66
#' vectors of length 1 (default: `TRUE`). passed to [jsonlite::toJSON()]
7-
#' @param pretty (logical) adds indentation whitespace to JSON output
7+
#' @param pretty (logical) adds indentation whitespace to JSON output
88
#' (default: `TRUE`), passed to [jsonlite::toJSON()]
99
#' @param ... further params passed to [jsonlite::toJSON()]
1010
#' @return an object of class `json`
@@ -17,8 +17,8 @@
1717
#' schema_org_writer(tmp)
1818
#' schema_org_writer(tmp, pretty = FALSE)
1919
#' }
20-
#'
21-
#' # many citeproc to schema
20+
#'
21+
#' # many citeproc to schema
2222
#' z <- system.file('extdata/citeproc-many.json', package = "handlr")
2323
#' w <- citeproc_reader(x = z)
2424
#' schema_org_writer(w)
@@ -32,23 +32,23 @@ schema_org_writer <- function(z, auto_unbox = TRUE, pretty = TRUE, ...) {
3232

3333
schema_hsh <- function(x) {
3434
ccp(list(
35-
"@context" = if (!is.null(x$id)) "http://schema.org" else NULL,
35+
"@context" = if (!is.null(x$id)) "https://schema.org" else NULL,
3636
"@type" = x$type,
3737
"@id" = x$id,
38-
"identifier" = to_schema_org_identifier(x$id,
38+
"identifier" = to_schema_org_identifier(x$id,
3939
ccp(list(alternate_identifier = x$alternate_identifier %||% NULL))),
4040
"url" = x$b_url,
4141
"additionalType" = x$additional_type,
4242
"name" = parse_attributes(x$title, content = "text", first = TRUE),
4343
"author" = to_schema_org(x$author),
4444
"editor" = to_schema_org(x$editor),
45-
"description" =
45+
"description" =
4646
parse_attributes(x$description, content = "text", first = TRUE),
4747
"license" = unlist(ccp(lapply(x$license, function(l) l$id))),
4848
"version" = x$software_version,
49-
"keywords" = if (!is.null(x$keywords))
50-
paste0(lapply(x$keywords, function(k)
51-
parse_attributes(k, content = "text", first = TRUE)),
49+
"keywords" = if (!is.null(x$keywords))
50+
paste0(lapply(x$keywords, function(k)
51+
parse_attributes(k, content = "text", first = TRUE)),
5252
collapse = ", ") else NULL,
5353
"inLanguage" = x$language %||% NULL,
5454
"contentSize" = x$content_size %||% NULL,
@@ -60,7 +60,7 @@ schema_hsh <- function(x) {
6060
"pageEnd" = x$last_page %||% NULL,
6161
"spatialCoverage" = x$spatial_coverage %||% NULL,
6262
"sameAs" = to_schema_org(x$is_identical_to),
63-
"isPartOf" = if (x$type == "Dataset") NULL else
63+
"isPartOf" = if (x$type == "Dataset") NULL else
6464
to_schema_org_container(x$is_part_of, list(
6565
container_title = x$container_title, type = x$type)),
6666
"hasPart" = to_schema_org(x$has_part),
@@ -70,13 +70,13 @@ schema_hsh <- function(x) {
7070
"@reverse" = x$reverse.presence,
7171
"contentUrl" = x$content_url %||% NULL,
7272
"schemaVersion" = x$schema_version %||% NULL,
73-
"includedInDataCatalog" = if (x$type == "Dataset")
74-
to_schema_org_container(x$is_part_of,
73+
"includedInDataCatalog" = if (x$type == "Dataset")
74+
to_schema_org_container(x$is_part_of,
7575
list(container_title = x$container_title, type = x$type)) else NULL,
76-
"publisher" = if (!is.null(x$publisher))
76+
"publisher" = if (!is.null(x$publisher))
7777
list("@type" = "Organization", "name" = x$publisher) else NULL,
7878
"funding" = to_schema_org(x$funding),
79-
"provider" = if (!is.null(x$service_provider))
79+
"provider" = if (!is.null(x$service_provider))
8080
list("@type" = "Organization", "name" = x$service_provider) else NULL
8181
))
8282
}
@@ -109,7 +109,7 @@ wrap_list <- function(m) {
109109
}
110110

111111
to_schema_org_identifier <- function(element, options = list()) {
112-
ident <- list(
112+
ident <- list(
113113
"@type" = "PropertyValue",
114114
propertyID = if (!is.null(normalize_doi(element))) "doi" else "url",
115115
value = element

‎R/translations.R‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# from https://github.com/datacite/bolognese/blob/master/lib/bolognese/utils.rb
22

33
LICENSE_NAMES <- list(
4-
"http://creativecommons.org/publicdomain/zero/1.0/" =
4+
"https://creativecommons.org/publicdomain/zero/1.0/" =
55
"Public Domain (CC0 1.0)",
6-
"http://creativecommons.org/licenses/by/3.0/" =
6+
"https://creativecommons.org/licenses/by/3.0/" =
77
"Creative Commons Attribution 3.0 (CC-BY 3.0)",
8-
"http://creativecommons.org/licenses/by/4.0/" =
8+
"https://creativecommons.org/licenses/by/4.0/" =
99
"Creative Commons Attribution 4.0 (CC-BY 4.0)",
10-
"http://creativecommons.org/licenses/by-nc/4.0/" =
10+
"https://creativecommons.org/licenses/by-nc/4.0/" =
1111
"Creative Commons Attribution Noncommercial 4.0 (CC-BY-NC 4.0)",
12-
"http://creativecommons.org/licenses/by-sa/4.0/" =
12+
"https://creativecommons.org/licenses/by-sa/4.0/" =
1313
"Creative Commons Attribution Share Alike 4.0 (CC-BY-SA 4.0)",
14-
"http://creativecommons.org/licenses/by-nc-nd/4.0/" =
14+
"https://creativecommons.org/licenses/by-nc-nd/4.0/" =
1515
"Creative Commons Attribution Noncommercial No Derivatives 4.0 (CC-BY-NC-ND 4.0)"
1616
)
1717

0 commit comments

Comments
 (0)