diff --git a/src/codecs/jats/__file_snapshots__/87253.json b/src/codecs/jats/__file_snapshots__/87253.json index ef7d8f8ab..febf25ddb 100644 --- a/src/codecs/jats/__file_snapshots__/87253.json +++ b/src/codecs/jats/__file_snapshots__/87253.json @@ -7187,7 +7187,7 @@ "id": "s1", "depth": 1, "content": [ - "Introduction" + "INTRODUCTION" ] }, { @@ -7703,7 +7703,7 @@ "id": "s2", "depth": 1, "content": [ - "Results" + "RESULTS" ] }, { @@ -9904,7 +9904,7 @@ "id": "s3", "depth": 1, "content": [ - "Discussion" + "DISCUSSION" ] }, { @@ -10257,7 +10257,7 @@ "id": "s4", "depth": 1, "content": [ - "Materials and methods" + "MATERIALS AND METHODS" ] }, { @@ -10763,7 +10763,7 @@ "id": "s4j", "depth": 2, "content": [ - "3 race" + "3’RACE" ] }, { @@ -10901,7 +10901,7 @@ "id": "s5", "depth": 1, "content": [ - "Data availability" + "DATA AVAILABILITY" ] }, { @@ -10918,7 +10918,7 @@ "id": "s6", "depth": 1, "content": [ - "Funding" + "FUNDING" ] }, { @@ -10951,7 +10951,7 @@ "id": "s7", "depth": 1, "content": [ - "Conflict of interest" + "CONFLICT OF INTEREST" ] }, { @@ -10968,7 +10968,7 @@ "id": "s8", "depth": 1, "content": [ - "Author contributions" + "AUTHOR CONTRIBUTIONS" ] }, { diff --git a/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json b/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json index 90805e949..c596121db 100644 --- a/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json +++ b/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json @@ -6753,7 +6753,7 @@ "id": "s1", "depth": 1, "content": [ - "Introduction" + "INTRODUCTION" ] }, { @@ -7008,7 +7008,7 @@ "id": "s2", "depth": 1, "content": [ - "Results" + "RESULTS" ] }, { @@ -8937,7 +8937,7 @@ "id": "s3", "depth": 1, "content": [ - "Discussion" + "DISCUSSION" ] }, { @@ -9388,7 +9388,7 @@ "id": "s4", "depth": 1, "content": [ - "Materials and methods" + "MATERIALS AND METHODS" ] }, { diff --git a/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json b/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json index 00c036df7..4c372b6ba 100644 --- a/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json +++ b/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json @@ -153,7 +153,7 @@ "type": "Heading", "depth": 1, "content": [ - "Summary" + "SUMMARY" ] }, { @@ -4312,7 +4312,7 @@ "id": "s1", "depth": 1, "content": [ - "Introduction" + "INTRODUCTION" ] }, { @@ -4851,7 +4851,7 @@ "id": "s2", "depth": 1, "content": [ - "Results" + "RESULTS" ] }, { @@ -6205,7 +6205,7 @@ "id": "s3", "depth": 1, "content": [ - "Discussion" + "DISCUSSION" ] }, { @@ -6389,7 +6389,7 @@ "id": "s4", "depth": 1, "content": [ - "Materials and methods" + "MATERIALS AND METHODS" ] }, { @@ -6712,7 +6712,7 @@ "id": "s5", "depth": 1, "content": [ - "Data availability" + "DATA AVAILABILITY" ] }, { @@ -6745,7 +6745,7 @@ "id": "s6", "depth": 1, "content": [ - "Author contributions" + "AUTHOR CONTRIBUTIONS" ] }, { @@ -6762,7 +6762,7 @@ "id": "s7", "depth": 1, "content": [ - "Declaration of interests" + "DECLARATION OF INTERESTS" ] }, { @@ -6779,7 +6779,7 @@ "id": "s8", "depth": 1, "content": [ - "Supplemental information" + "SUPPLEMENTAL INFORMATION" ] }, { diff --git a/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json b/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json index 8c73afed8..3b38811c7 100644 --- a/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json +++ b/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json @@ -5021,7 +5021,7 @@ "id": "s1", "depth": 1, "content": [ - "Introduction" + "INTRODUCTION" ] }, { @@ -5279,7 +5279,7 @@ "id": "s2", "depth": 1, "content": [ - "Materials and methods" + "MATERIALS AND METHODS" ] }, { @@ -5563,7 +5563,7 @@ "id": "s2b7", "depth": 3, "content": [ - "Ltpa" + "LTPA" ] }, { @@ -5836,7 +5836,7 @@ "id": "s3", "depth": 1, "content": [ - "Results" + "RESULTS" ] }, { @@ -6339,7 +6339,7 @@ "id": "s4", "depth": 1, "content": [ - "Discussion" + "DISCUSSION" ] }, { diff --git a/src/codecs/jats/index.ts b/src/codecs/jats/index.ts index 3ec6688ed..0a9d868a1 100644 --- a/src/codecs/jats/index.ts +++ b/src/codecs/jats/index.ts @@ -19,7 +19,6 @@ import stencila, { isA, ThingTypes } from '@stencila/schema' import crypto from 'crypto' import { dropLeft, takeLeftWhile } from 'fp-ts/lib/Array' import fs from 'fs-extra' -import { sentenceCase } from 'sentence-case' import { isDefined } from '../../util' import { ensureArticle } from '../../util/content/ensureArticle' import { ensureBlockContent } from '../../util/content/ensureBlockContent' @@ -573,7 +572,8 @@ export function decodeAbstract( !( block.type === 'Heading' && block.content.length === 1 && - block.content[0] === 'Abstract' + typeof block.content[0] === 'string' && + block.content[0].toUpperCase() === 'ABSTRACT' ), ) } @@ -1877,9 +1877,6 @@ function decodeAppendix( * implies a nested section. This is more likely to ensure conformance with * the following rule if the document is encoded to HTML: * https://dequeuniversity.com/rules/axe/3.5/heading-order - * - * For consistency, across documents all caps titles are converted to - * sentence case. */ function decodeHeading( elem: xml.Element, @@ -1891,20 +1888,12 @@ function decodeHeading( ancestorElem?.name === 'sec' || ancestorElem?.name === 'app' ? [sectionDepth, sectionId] : [sectionDepth + 1, undefined] - let content = decodeInlineContent(elem.elements ?? [], state) + const content = decodeInlineContent(elem.elements ?? [], state) if (depth === undefined || Number.isNaN(depth)) { depth = 1 } - if ( - content.length === 1 && - typeof content[0] === 'string' && - content[0].toUpperCase() === content[0] - ) { - content = [sentenceCase(content[0])] - } - return [ stencila.heading({ content,