Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@manuscripts/transform",
"description": "ProseMirror transformer for Manuscripts applications",
"version": "4.5.6",
"version": "4.5.7-LEAN-6041.0",
"repository": "github:Atypon-OpenSource/manuscripts-transform",
"license": "Apache-2.0",
"main": "dist/cjs",
Expand Down
17 changes: 14 additions & 3 deletions src/jats/exporter/citeproc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const initJats = () => {
const namesWrapper = (type: string) => (str: string) =>
`<person-group person-group-type="${type}">${str}</person-group>`

const authorNamesWrapper = namesWrapper('author')
// Even though the CSL data model specifies a date type, citeproc-js processes
// date fields and replaces their value with an object with the structure:
// {
Expand Down Expand Up @@ -182,9 +183,19 @@ const getPublicationType = (item: BibliographyItemAttrs) => {
}

const wrappers = {
// this is a name field, so other processing is required. See the "initJats"
// function for more info.
author: namesWrapper('author'),
// This is a name field, so other processing is required. See the
// "initJats" function for more info on name rendering.
//
// When an item has neither "author" nor "editor" data, the CSL style's
// author-substitute rule
// falls back to rendering the item's "title" in this slot instead. In
// that case the string received here is the title, not a name, so it's
// routed through the "title" wrapper to produce the correct JATS title
// element instead of being mislabeled as a <person-group>.
author: (str: string, item: BibliographyItemAttrs) => {
const hasNames = item.author?.length || item.editor?.length
return hasNames ? authorNamesWrapper(str) : wrappers.title(str, item)
},
Comment thread
mbartenev-atypon marked this conversation as resolved.
Comment thread
mbetamony marked this conversation as resolved.
// Unlike other date fields, where a formatted date string is wrapped in
// a tag with the "iso-8601-date" attribute, the "issued" date components
// are individually wrapped in year/month/day tags. For the time being,
Expand Down