Skip to content

Commit

Permalink
Preserve roles' original case in PlumeQuarto (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgallou authored Sep 1, 2024
1 parent f23c1a1 commit 67a1369
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# plume (development version)

* `PlumeQuarto` no longer converts roles to lower case (#88).

* `PlumeQuarto` now supports authors' `degrees` field and the `group` affiliation property (#53).

* `PlumeQuarto` now properly handles authors with no roles (#81).
Expand Down
13 changes: 3 additions & 10 deletions R/plume-quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlumeQuarto <- R6Class(
degrees = private$itemise("degree"),
acknowledgements = private$pull("acknowledgements"),
attributes = private$author_attributes(),
roles = private$itemise("role", to_lower = TRUE),
roles = private$itemise("role"),
metadata = private$author_metadata(),
affiliations = private$author_affiliations()
)
Expand All @@ -156,8 +156,8 @@ PlumeQuarto <- R6Class(
out
},

itemise = function(var, to_lower = FALSE) {
private$pull_nestable(var, \(x) itemise(x, to_lower))
itemise = function(var) {
private$pull_nestable(var, \(x) list(vec_drop_na(x)))
},

author_notes = function() {
Expand Down Expand Up @@ -241,13 +241,6 @@ PlumeQuarto <- R6Class(
)
)

itemise <- function(x, to_lower = FALSE) {
if (to_lower) {
x <- tolower(x)
}
list(vec_drop_na(x))
}

affiliation_keys <- c(
"number", "name", "department", "address", "city", "region", "state",
"country", "postal-code", "url", "isni", "ringgold", "ror", "group"
Expand Down
20 changes: 10 additions & 10 deletions tests/testthat/_snaps/to-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
attributes:
corresponding: true
roles:
- formal analysis
- writing - original draft
- Formal analysis
- Writing - original draft
affiliations:
- ref: aff1
- ref: aff2
Expand All @@ -31,7 +31,7 @@
attributes:
corresponding: false
roles:
- formal analysis
- Formal analysis
affiliations:
- ref: aff3
- id: aut3
Expand All @@ -43,7 +43,7 @@
attributes:
corresponding: false
roles:
- formal analysis
- Formal analysis
affiliations:
- ref: aff1
- ref: aff4
Expand Down Expand Up @@ -80,7 +80,7 @@
attributes:
corresponding: true
roles:
- formal analysis
- Formal analysis
affiliations:
- ref: aff1
- ref: aff2
Expand All @@ -93,7 +93,7 @@
attributes:
corresponding: false
roles:
- formal analysis
- Formal analysis
affiliations:
- ref: aff3
- id: aut3
Expand All @@ -107,8 +107,8 @@
attributes:
corresponding: false
roles:
- formal analysis
- writing - original draft
- Formal analysis
- Writing - original draft
affiliations:
- ref: aff2
- ref: aff4
Expand Down Expand Up @@ -243,8 +243,8 @@
given: A
family: A
roles:
- formal analysis
- writing - original draft
- Formal analysis
- Writing - original draft
- id: aut2
name:
given: B
Expand Down

0 comments on commit 67a1369

Please sign in to comment.