@manuscripts/transform 2.3.35 → 2.3.37-LEAN-3911.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jats/importer/create-article-node.js +31 -0
- package/dist/cjs/jats/importer/index.js +3 -3
- package/dist/cjs/jats/importer/jats-body-transformations.js +70 -0
- package/dist/cjs/jats/importer/jats-comments.js +27 -104
- package/dist/cjs/jats/importer/{jats-body-dom-parser.js → jats-dom-parser.js} +229 -9
- package/dist/cjs/jats/importer/jats-front-transformations.js +262 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +8 -1
- package/dist/cjs/jats/importer/jats-parser-utils.js +39 -5
- package/dist/cjs/jats/importer/jats-reference-parser.js +16 -27
- package/dist/cjs/jats/importer/jats-references.js +18 -18
- package/dist/cjs/jats/importer/parse-jats-article.js +42 -78
- package/dist/cjs/jats/index.js +4 -3
- package/dist/cjs/jats/jats-exporter.js +252 -354
- package/dist/cjs/{transformer → jats}/labels.js +3 -3
- package/dist/cjs/lib/utils.js +9 -1
- package/dist/cjs/schema/index.js +2 -0
- package/dist/cjs/schema/nodes/box_element.js +55 -0
- package/dist/cjs/transformer/id.js +10 -5
- package/dist/cjs/transformer/index.js +0 -18
- package/dist/cjs/transformer/node-types.js +1 -0
- package/dist/cjs/transformer/section-category.js +8 -0
- package/dist/cjs/version.js +1 -1
- package/dist/{cjs/transformer/serializer.js → es/jats/importer/create-article-node.js} +12 -8
- package/dist/es/jats/importer/index.js +2 -1
- package/dist/es/jats/importer/jats-body-transformations.js +70 -0
- package/dist/es/jats/importer/jats-comments.js +26 -101
- package/dist/es/jats/importer/{jats-body-dom-parser.js → jats-dom-parser.js} +230 -10
- package/dist/es/jats/importer/jats-front-transformations.js +259 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +6 -0
- package/dist/es/jats/importer/jats-parser-utils.js +40 -6
- package/dist/es/jats/importer/jats-reference-parser.js +16 -27
- package/dist/es/jats/importer/jats-references.js +18 -18
- package/dist/es/jats/importer/parse-jats-article.js +43 -77
- package/dist/es/jats/index.js +3 -1
- package/dist/es/jats/jats-exporter.js +254 -356
- package/dist/es/{transformer → jats}/labels.js +3 -3
- package/dist/es/lib/utils.js +7 -0
- package/dist/es/schema/index.js +2 -0
- package/dist/es/schema/nodes/box_element.js +52 -0
- package/dist/es/transformer/id.js +8 -3
- package/dist/es/transformer/index.js +0 -16
- package/dist/es/transformer/node-types.js +1 -0
- package/dist/es/transformer/section-category.js +8 -0
- package/dist/es/version.js +1 -1
- package/dist/{cjs/transformer/models.js → types/jats/importer/create-article-node.d.ts} +3 -3
- package/dist/types/jats/importer/index.d.ts +2 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +5 -0
- package/dist/types/jats/importer/jats-comments.d.ts +4 -10
- package/dist/types/jats/importer/{jats-body-dom-parser.d.ts → jats-dom-parser.d.ts} +1 -1
- package/dist/types/jats/importer/jats-front-transformations.d.ts +38 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +10 -0
- package/dist/types/jats/importer/jats-references.d.ts +19 -8
- package/dist/types/jats/importer/parse-jats-article.d.ts +12 -5
- package/dist/types/jats/index.d.ts +3 -1
- package/dist/types/jats/jats-exporter.d.ts +10 -29
- package/dist/types/{transformer → jats}/labels.d.ts +2 -1
- package/dist/types/lib/utils.d.ts +3 -0
- package/dist/types/schema/nodes/bibliography_item.d.ts +28 -5
- package/dist/{es/transformer/models.js → types/schema/nodes/box_element.d.ts} +10 -0
- package/dist/types/schema/nodes/contributor.d.ts +10 -0
- package/dist/types/schema/nodes/keyword_group.d.ts +1 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/id.d.ts +5 -2
- package/dist/types/transformer/index.d.ts +0 -16
- package/dist/types/transformer/section-category.d.ts +2 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -1
- package/dist/cjs/__tests__/data/project-dump.json +0 -825
- package/dist/cjs/jats/importer/jats-front-parser.js +0 -321
- package/dist/cjs/transformer/__tests__/__helpers__/doc.js +0 -37
- package/dist/cjs/transformer/builders.js +0 -219
- package/dist/cjs/transformer/decode.js +0 -874
- package/dist/cjs/transformer/document-object-types.js +0 -31
- package/dist/cjs/transformer/encode.js +0 -664
- package/dist/cjs/transformer/footnote-category.js +0 -20
- package/dist/cjs/transformer/footnotes-order.js +0 -60
- package/dist/cjs/transformer/highlight-markers.js +0 -138
- package/dist/cjs/transformer/html.js +0 -400
- package/dist/cjs/transformer/manuscript-dependencies.js +0 -21
- package/dist/cjs/transformer/model-map.js +0 -26
- package/dist/cjs/transformer/object-types.js +0 -57
- package/dist/cjs/transformer/project-bundle.js +0 -94
- package/dist/cjs/transformer/update-identifiers.js +0 -93
- package/dist/es/__tests__/data/project-dump.json +0 -825
- package/dist/es/jats/importer/jats-front-parser.js +0 -315
- package/dist/es/transformer/__tests__/__helpers__/doc.js +0 -29
- package/dist/es/transformer/builders.js +0 -186
- package/dist/es/transformer/decode.js +0 -864
- package/dist/es/transformer/document-object-types.js +0 -28
- package/dist/es/transformer/encode.js +0 -654
- package/dist/es/transformer/footnote-category.js +0 -16
- package/dist/es/transformer/footnotes-order.js +0 -55
- package/dist/es/transformer/highlight-markers.js +0 -132
- package/dist/es/transformer/html.js +0 -393
- package/dist/es/transformer/manuscript-dependencies.js +0 -17
- package/dist/es/transformer/model-map.js +0 -22
- package/dist/es/transformer/object-types.js +0 -52
- package/dist/es/transformer/project-bundle.js +0 -85
- package/dist/es/transformer/serializer.js +0 -17
- package/dist/es/transformer/update-identifiers.js +0 -87
- package/dist/types/jats/importer/jats-front-parser.d.ts +0 -84
- package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +0 -18
- package/dist/types/transformer/builders.d.ts +0 -61
- package/dist/types/transformer/decode.d.ts +0 -51
- package/dist/types/transformer/document-object-types.d.ts +0 -17
- package/dist/types/transformer/encode.d.ts +0 -29
- package/dist/types/transformer/footnote-category.d.ts +0 -17
- package/dist/types/transformer/footnotes-order.d.ts +0 -22
- package/dist/types/transformer/highlight-markers.d.ts +0 -31
- package/dist/types/transformer/html.d.ts +0 -36
- package/dist/types/transformer/manuscript-dependencies.d.ts +0 -4
- package/dist/types/transformer/model-map.d.ts +0 -19
- package/dist/types/transformer/models.d.ts +0 -48
- package/dist/types/transformer/object-types.d.ts +0 -30
- package/dist/types/transformer/project-bundle.d.ts +0 -30
- package/dist/types/transformer/serializer.d.ts +0 -19
- package/dist/types/transformer/update-identifiers.d.ts +0 -23
- /package/dist/cjs/{transformer → jats}/filename.js +0 -0
- /package/dist/cjs/{transformer → jats}/timestamp.js +0 -0
- /package/dist/es/{transformer → jats}/filename.js +0 -0
- /package/dist/es/{transformer → jats}/timestamp.js +0 -0
- /package/dist/types/{transformer → jats}/filename.d.ts +0 -0
- /package/dist/types/{transformer → jats}/timestamp.d.ts +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { schema } from '../schema';
|
|
17
|
-
import { nodeNames } from '
|
|
17
|
+
import { nodeNames } from '../transformer/node-names';
|
|
18
18
|
const labelledNodeTypes = [
|
|
19
19
|
schema.nodes.figure_element,
|
|
20
20
|
schema.nodes.table_element,
|
|
@@ -25,7 +25,7 @@ const excludedTypes = [schema.nodes.graphical_abstract_section];
|
|
|
25
25
|
const chooseLabel = (nodeType) => {
|
|
26
26
|
return nodeNames.get(nodeType);
|
|
27
27
|
};
|
|
28
|
-
export const buildTargets = (
|
|
28
|
+
export const buildTargets = (node) => {
|
|
29
29
|
const counters = {};
|
|
30
30
|
for (const nodeType of labelledNodeTypes) {
|
|
31
31
|
counters[nodeType.name] = {
|
|
@@ -39,7 +39,7 @@ export const buildTargets = (fragment) => {
|
|
|
39
39
|
return `${counter.label} ${counter.index}`;
|
|
40
40
|
};
|
|
41
41
|
const targets = new Map();
|
|
42
|
-
|
|
42
|
+
node.descendants((node, pos, parent) => {
|
|
43
43
|
var _a;
|
|
44
44
|
if (node.type.name in counters) {
|
|
45
45
|
if (parent && excludedTypes.includes(parent.type)) {
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -74,3 +74,10 @@ export const getTrimmedTextContent = (node, querySelector) => {
|
|
|
74
74
|
}
|
|
75
75
|
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
76
76
|
};
|
|
77
|
+
export const setElementAttributes = (element, attributes) => {
|
|
78
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
79
|
+
if (value) {
|
|
80
|
+
element.setAttribute(key, value);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
package/dist/es/schema/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { bibliographyItem } from './nodes/bibliography_item';
|
|
|
26
26
|
import { bibliographySection } from './nodes/bibliography_section';
|
|
27
27
|
import { blockquoteElement } from './nodes/blockquote_element';
|
|
28
28
|
import { body } from './nodes/body';
|
|
29
|
+
import { box_element } from './nodes/box_element';
|
|
29
30
|
import { caption } from './nodes/caption';
|
|
30
31
|
import { captionTitle } from './nodes/caption_title';
|
|
31
32
|
import { citation } from './nodes/citation';
|
|
@@ -220,5 +221,6 @@ export const schema = new Schema({
|
|
|
220
221
|
supplement,
|
|
221
222
|
author_notes: authorNotes,
|
|
222
223
|
corresp,
|
|
224
|
+
box_element,
|
|
223
225
|
},
|
|
224
226
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const box_element = {
|
|
17
|
+
content: 'figcaption? section?',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
label: { default: '' },
|
|
21
|
+
dataTracked: { default: null },
|
|
22
|
+
},
|
|
23
|
+
group: 'block element',
|
|
24
|
+
selectable: false,
|
|
25
|
+
parseDOM: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'div.boxed-text',
|
|
28
|
+
getAttrs: (p) => {
|
|
29
|
+
const dom = p;
|
|
30
|
+
const attrs = {
|
|
31
|
+
id: dom.getAttribute('id') || undefined,
|
|
32
|
+
label: dom.getAttribute('label') || undefined,
|
|
33
|
+
};
|
|
34
|
+
return attrs;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
toDOM: (node) => {
|
|
39
|
+
const boxElementNode = node;
|
|
40
|
+
const attrs = {};
|
|
41
|
+
if (boxElementNode.attrs.id) {
|
|
42
|
+
attrs.id = boxElementNode.attrs.id;
|
|
43
|
+
}
|
|
44
|
+
if (boxElementNode.attrs.label) {
|
|
45
|
+
attrs.label = boxElementNode.attrs.label;
|
|
46
|
+
}
|
|
47
|
+
return [
|
|
48
|
+
'div',
|
|
49
|
+
Object.assign({ class: 'boxed-text' }, attrs),
|
|
50
|
+
];
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { v4 as uuid } from 'uuid';
|
|
17
17
|
import { nodeTypesMap } from './node-types';
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export var ExtraObjectTypes;
|
|
19
|
+
(function (ExtraObjectTypes) {
|
|
20
|
+
ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
|
|
21
|
+
ExtraObjectTypes["GeneralTableFootnote"] = "MPGeneralTableFootnote";
|
|
22
|
+
})(ExtraObjectTypes || (ExtraObjectTypes = {}));
|
|
21
23
|
export const generateID = (objectType) => {
|
|
22
24
|
return objectType + ':' + uuid().toUpperCase();
|
|
23
25
|
};
|
|
26
|
+
export const generateNodeID = (type) => {
|
|
27
|
+
return nodeTypesMap.get(type) + ':' + uuid().toUpperCase();
|
|
28
|
+
};
|
|
@@ -13,24 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export * from './builders';
|
|
17
|
-
export * from './decode';
|
|
18
|
-
export * from './document-object-types';
|
|
19
|
-
export * from './encode';
|
|
20
|
-
export * from './filename';
|
|
21
|
-
export * from './highlight-markers';
|
|
22
|
-
export * from './html';
|
|
23
16
|
export * from './id';
|
|
24
|
-
export * from './labels';
|
|
25
|
-
export * from './manuscript-dependencies';
|
|
26
|
-
export * from './models';
|
|
27
17
|
export * from './node-names';
|
|
28
18
|
export * from './node-title';
|
|
29
19
|
export * from './node-types';
|
|
30
|
-
export * from './object-types';
|
|
31
|
-
export * from './project-bundle';
|
|
32
20
|
export * from './section-category';
|
|
33
|
-
export * from './serializer';
|
|
34
|
-
export * from './timestamp';
|
|
35
|
-
export * from './update-identifiers';
|
|
36
|
-
export { createTestDoc } from './__tests__/__helpers__/doc';
|
|
@@ -59,6 +59,7 @@ export const nodeTypesMap = new Map([
|
|
|
59
59
|
[schema.nodes.supplement, ObjectTypes.Supplement],
|
|
60
60
|
[schema.nodes.author_notes, ObjectTypes.AuthorNotes],
|
|
61
61
|
[schema.nodes.corresp, ObjectTypes.Corresponding],
|
|
62
|
+
[schema.nodes.box_element, ObjectTypes.Section],
|
|
62
63
|
]);
|
|
63
64
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
64
65
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -36,6 +36,8 @@ export const chooseSectionNodeType = (category) => {
|
|
|
36
36
|
return schema.nodes.keywords;
|
|
37
37
|
case 'MPSectionCategory:toc':
|
|
38
38
|
return schema.nodes.toc_section;
|
|
39
|
+
case 'MPSectionCategory:box-element':
|
|
40
|
+
return schema.nodes.box_element;
|
|
39
41
|
default:
|
|
40
42
|
return schema.nodes.section;
|
|
41
43
|
}
|
|
@@ -77,6 +79,8 @@ export const buildSectionCategory = (node) => {
|
|
|
77
79
|
return 'MPSectionCategory:toc';
|
|
78
80
|
case schema.nodes.graphical_abstract_section:
|
|
79
81
|
return 'MPSectionCategory:abstract-graphical';
|
|
82
|
+
case schema.nodes.box_element:
|
|
83
|
+
return 'MPSectionCategory:box-element';
|
|
80
84
|
default:
|
|
81
85
|
return node.attrs.category || undefined;
|
|
82
86
|
}
|
|
@@ -186,6 +190,8 @@ export const chooseSectionCategoryByType = (secType) => {
|
|
|
186
190
|
return 'MPSectionCategory:supported-by';
|
|
187
191
|
case 'ethics-statement':
|
|
188
192
|
return 'MPSectionCategory:ethics-statement';
|
|
193
|
+
case 'box-element':
|
|
194
|
+
return 'MPSectionCategory:box-element';
|
|
189
195
|
default:
|
|
190
196
|
return undefined;
|
|
191
197
|
}
|
|
@@ -240,5 +246,7 @@ export const chooseSectionCategoryFromTitle = (title) => {
|
|
|
240
246
|
case 'financial-disclosure':
|
|
241
247
|
case 'funding information':
|
|
242
248
|
return 'MPSectionCategory:financial-disclosure';
|
|
249
|
+
case 'box-element':
|
|
250
|
+
return 'MPSectionCategory:box-element';
|
|
243
251
|
}
|
|
244
252
|
};
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.37-LEAN-3911.0";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*!
|
|
3
|
-
* ©
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,4 +13,5 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
import { Manuscript } from '@manuscripts/json-schema';
|
|
17
|
+
export declare const createArticleNode: (manuscript: Partial<Manuscript>) => import("prosemirror-model").Node;
|
|
@@ -13,4 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
16
|
+
export { createArticleNode } from './create-article-node';
|
|
17
|
+
export { parseJATSArticle } from './parse-jats-article';
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { BibliographyItemAttributes } from '../../schema';
|
|
17
|
+
import { References } from './jats-references';
|
|
16
18
|
export declare const jatsBodyTransformations: {
|
|
17
19
|
ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
18
20
|
createAbstractSection(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
@@ -36,4 +38,7 @@ export declare const jatsBodyTransformations: {
|
|
|
36
38
|
moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
39
|
createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
38
40
|
createSuppleMaterials(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
41
|
+
moveReferencesToBackmatter(body: Element, references: References | undefined, createElement: (tagName: string) => HTMLElement): void;
|
|
42
|
+
createBibliographySection(createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
43
|
+
createBibliographyItem(item: BibliographyItemAttributes, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
39
44
|
};
|
|
@@ -13,18 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
|
-
import { References } from './jats-references';
|
|
18
16
|
export type JATSComment = {
|
|
19
|
-
|
|
17
|
+
index: number;
|
|
20
18
|
text: string;
|
|
19
|
+
id: string;
|
|
21
20
|
};
|
|
22
|
-
export
|
|
23
|
-
token: string;
|
|
24
|
-
comment: JATSComment;
|
|
25
|
-
};
|
|
21
|
+
export declare const DEFAULT_PROFILE_ID = "MPUserProfile:0000000000000000000000000000000000000001";
|
|
26
22
|
export declare const isJATSComment: (node: Node) => boolean;
|
|
27
23
|
export declare const parseJATSComment: (node: Node) => JATSComment | undefined;
|
|
28
|
-
export declare const markComments: (doc: Document) =>
|
|
29
|
-
export declare const createComments: (models: Model[], marks: JATSCommentMark[]) => CommentAnnotation[];
|
|
30
|
-
export declare const createReferenceComments: (references: References) => CommentAnnotation[];
|
|
24
|
+
export declare const markComments: (doc: Document) => void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const defaultTitle = "Untitled Manuscript";
|
|
17
|
+
export declare const jatsFrontTransformations: {
|
|
18
|
+
setArticleAttrs(doc: Document, template?: string): void;
|
|
19
|
+
createTitle(front: Element, createElement: (tagName: string) => HTMLElement): Element;
|
|
20
|
+
createAuthorNotes(document: Document, createElement: (tagName: string) => HTMLElement): HTMLElement | undefined;
|
|
21
|
+
appendFootnote(node: Element, element: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
22
|
+
appendParagraph(document: Document, node: Element, element: Element): void;
|
|
23
|
+
appendCorresp(node: Element, element: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
24
|
+
createContributors(front: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
25
|
+
createContributorElement(priority: number, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
26
|
+
setNameAttrs(node: Element, element: Element): void;
|
|
27
|
+
setOrcidAttribute(node: Element, element: Element): void;
|
|
28
|
+
setIsCorrespondingAttribute(node: Element, element: Element): void;
|
|
29
|
+
setContributorReferences(node: Element, element: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
30
|
+
appendFootnoteID(xref: Element, footnotes: Element, rid: string, createElement: (tagName: string) => HTMLElement): void;
|
|
31
|
+
appendCorrespID(xref: Element, corresps: Element, rid: string, createElement: (tagName: string) => HTMLElement): void;
|
|
32
|
+
appendAffiliationID(affs: Element, rid: string, createElement: (tagName: string) => HTMLElement): void;
|
|
33
|
+
createAffiliations(front: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
34
|
+
createAffiliationElement(element: Element, priority: number, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
35
|
+
appendEmail(element: Element, affiliation: Element): void;
|
|
36
|
+
setInstitutionAttrs(element: Element, affiliation: Element): void;
|
|
37
|
+
setAddressAttrs(element: Element, affiliation: Element): void;
|
|
38
|
+
};
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
16
17
|
export type ISSN = {
|
|
17
18
|
ISSN: string;
|
|
18
19
|
publicationType?: string;
|
|
@@ -35,3 +36,12 @@ export declare const parseJournalMeta: (element: Element | null) => {
|
|
|
35
36
|
publisherName: string | undefined;
|
|
36
37
|
title: string | undefined;
|
|
37
38
|
};
|
|
39
|
+
export declare const parseJournal: (element: Element | null) => {
|
|
40
|
+
_id: string;
|
|
41
|
+
objectType: ObjectTypes;
|
|
42
|
+
abbreviatedTitles: AbbreviatedTitle[];
|
|
43
|
+
journalIdentifiers: JournalIdentifier[];
|
|
44
|
+
ISSNs: ISSN[];
|
|
45
|
+
publisherName: string | undefined;
|
|
46
|
+
title: string | undefined;
|
|
47
|
+
};
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { BibliographyItemAttributes } from '../../schema';
|
|
3
17
|
export declare class References {
|
|
4
|
-
items: Map<string,
|
|
18
|
+
items: Map<string, BibliographyItemAttributes>;
|
|
5
19
|
IDs: Map<string, string>;
|
|
6
|
-
comments: Map<string, JATSComment[]>;
|
|
7
20
|
constructor();
|
|
8
|
-
add(item:
|
|
9
|
-
getBibliographyItems():
|
|
10
|
-
getComments(id: string): JATSComment[];
|
|
11
|
-
private getValue;
|
|
21
|
+
add(item: BibliographyItemAttributes, id: string | null): void;
|
|
22
|
+
getBibliographyItems(): BibliographyItemAttributes[];
|
|
12
23
|
}
|
|
@@ -13,8 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
export declare const parseJATSArticle: (doc: Document, template?: string) => {
|
|
17
|
+
node: import("prosemirror-model").Node;
|
|
18
|
+
journal: {
|
|
19
|
+
_id: string;
|
|
20
|
+
objectType: import("@manuscripts/json-schema/dist/types").ObjectTypes;
|
|
21
|
+
abbreviatedTitles: import("./jats-journal-meta-parser").AbbreviatedTitle[];
|
|
22
|
+
journalIdentifiers: import("./jats-journal-meta-parser").JournalIdentifier[];
|
|
23
|
+
ISSNs: import("./jats-journal-meta-parser").ISSN[];
|
|
24
|
+
publisherName: string | undefined;
|
|
25
|
+
title: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
16
|
+
export { parseJATSArticle, createArticleNode } from './importer';
|
|
17
17
|
export * from './jats-exporter';
|
|
18
18
|
export * from './jats-versions';
|
|
19
|
+
export * from './timestamp';
|
|
20
|
+
export * from './labels';
|
|
@@ -13,18 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { BibliographyItem, Journal, Manuscript } from '@manuscripts/json-schema';
|
|
17
17
|
import { CitationProvider } from '@manuscripts/library';
|
|
18
18
|
import { DOMSerializer } from 'prosemirror-model';
|
|
19
|
-
import { CitationNode,
|
|
20
|
-
import { Target } from '../transformer/labels';
|
|
19
|
+
import { CitationNode, ManuscriptNode } from '../schema';
|
|
21
20
|
import { IDGenerator, MediaPathGenerator } from '../types';
|
|
22
|
-
import {
|
|
23
|
-
interface Links {
|
|
24
|
-
self?: {
|
|
25
|
-
[key: string]: string;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
21
|
+
import { Target } from './labels';
|
|
28
22
|
export declare const createCounter: () => {
|
|
29
23
|
increment: (field: string) => number;
|
|
30
24
|
};
|
|
@@ -32,17 +26,6 @@ export type CSLOptions = {
|
|
|
32
26
|
style: string;
|
|
33
27
|
locale: string;
|
|
34
28
|
};
|
|
35
|
-
export interface JATSExporterOptions {
|
|
36
|
-
csl: CSLOptions;
|
|
37
|
-
version?: Version;
|
|
38
|
-
doi?: string;
|
|
39
|
-
id?: string;
|
|
40
|
-
frontMatterOnly?: boolean;
|
|
41
|
-
links?: Links;
|
|
42
|
-
citationType?: 'element' | 'mixed';
|
|
43
|
-
idGenerator?: IDGenerator;
|
|
44
|
-
mediaPathGenerator?: MediaPathGenerator;
|
|
45
|
-
}
|
|
46
29
|
export declare const buildCitations: (citations: CitationNode[]) => {
|
|
47
30
|
citationID: string;
|
|
48
31
|
citationItems: {
|
|
@@ -54,13 +37,12 @@ export declare const buildCitations: (citations: CitationNode[]) => {
|
|
|
54
37
|
}[];
|
|
55
38
|
export declare class JATSExporter {
|
|
56
39
|
protected document: Document;
|
|
57
|
-
protected modelMap: Map<string, Model>;
|
|
58
|
-
protected models: Model[];
|
|
59
40
|
protected serializer: DOMSerializer;
|
|
60
41
|
protected labelTargets?: Map<string, Target>;
|
|
61
42
|
protected citationTexts: Map<string, string>;
|
|
62
43
|
protected citationProvider: CitationProvider;
|
|
63
|
-
protected
|
|
44
|
+
protected manuscriptNode: ManuscriptNode;
|
|
45
|
+
protected generateCitations(): {
|
|
64
46
|
citationID: string;
|
|
65
47
|
citationItems: {
|
|
66
48
|
id: string;
|
|
@@ -69,20 +51,20 @@ export declare class JATSExporter {
|
|
|
69
51
|
noteIndex: number;
|
|
70
52
|
};
|
|
71
53
|
}[];
|
|
72
|
-
protected
|
|
73
|
-
|
|
54
|
+
protected getLibraryItem: (manuscriptID: string) => (id: string) => BibliographyItem | undefined;
|
|
55
|
+
protected generateCitationTexts(csl: CSLOptions, manuscriptID: string): void;
|
|
56
|
+
serializeToJATS: (manuscriptNode: ManuscriptNode, csl: CSLOptions, manuscript: Manuscript, jorunal?: Journal) => Promise<string>;
|
|
74
57
|
private nodeFromJATS;
|
|
75
58
|
protected rewriteMediaPaths: (generator: MediaPathGenerator) => Promise<void>;
|
|
76
59
|
protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
|
|
77
60
|
protected setTitleContent: (element: HTMLElement, title: string) => void;
|
|
78
|
-
protected buildFront: (
|
|
61
|
+
protected buildFront: (manuscript: Manuscript, journal?: Journal) => HTMLElement;
|
|
79
62
|
protected buildDateElement: (timestamp: number, type: string) => HTMLElement;
|
|
80
63
|
protected buildCountingElement: (tagName: string, count: number | undefined) => HTMLElement | undefined;
|
|
81
|
-
protected buildBody: (
|
|
64
|
+
protected buildBody: () => HTMLBodyElement;
|
|
82
65
|
protected buildBack: (body: HTMLElement) => HTMLElement;
|
|
83
66
|
protected createSerializer: () => void;
|
|
84
67
|
private createEquation;
|
|
85
|
-
protected serializeFragment: (fragment: ManuscriptFragment) => HTMLElement | DocumentFragment;
|
|
86
68
|
protected serializeNode: (node: ManuscriptNode) => Node;
|
|
87
69
|
private validateContributor;
|
|
88
70
|
private buildContributors;
|
|
@@ -109,4 +91,3 @@ export declare class JATSExporter {
|
|
|
109
91
|
private fillEmptyFootnotes;
|
|
110
92
|
private fillEmptyTableFooters;
|
|
111
93
|
}
|
|
112
|
-
export {};
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { ManuscriptNode } from 'migration-base';
|
|
16
17
|
import { ManuscriptFragment } from '../schema';
|
|
17
18
|
export interface Target {
|
|
18
19
|
type: string;
|
|
@@ -20,4 +21,4 @@ export interface Target {
|
|
|
20
21
|
label: string;
|
|
21
22
|
caption: string;
|
|
22
23
|
}
|
|
23
|
-
export declare const buildTargets: (
|
|
24
|
+
export declare const buildTargets: (node: ManuscriptNode | ManuscriptFragment) => Map<string, Target>;
|
|
@@ -26,3 +26,6 @@ export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate:
|
|
|
26
26
|
node: ProsemirrorNode;
|
|
27
27
|
} | undefined;
|
|
28
28
|
export declare const getTrimmedTextContent: (node: Element | Document | null, querySelector: string) => string | null | undefined;
|
|
29
|
+
export declare const setElementAttributes: (element: Element, attributes: {
|
|
30
|
+
[key: string]: string | undefined;
|
|
31
|
+
}) => void;
|
|
@@ -13,14 +13,36 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographicDate, BibliographicName } from '@manuscripts/json-schema';
|
|
17
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
18
17
|
import { ManuscriptNode } from '../types';
|
|
19
|
-
|
|
18
|
+
type LooseNumber = string | number;
|
|
19
|
+
export interface BibliographyItemAuthor {
|
|
20
|
+
given?: string;
|
|
21
|
+
family?: string;
|
|
22
|
+
_id: string;
|
|
23
|
+
objectType: 'MPBibliographicName';
|
|
24
|
+
}
|
|
25
|
+
export interface BibliographyItemDate {
|
|
26
|
+
'date-parts'?: [
|
|
27
|
+
[
|
|
28
|
+
LooseNumber,
|
|
29
|
+
LooseNumber?,
|
|
30
|
+
LooseNumber?
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
LooseNumber,
|
|
34
|
+
LooseNumber?,
|
|
35
|
+
LooseNumber?
|
|
36
|
+
]?
|
|
37
|
+
];
|
|
38
|
+
_id: string;
|
|
39
|
+
objectType: 'MPBibliographicDate';
|
|
40
|
+
}
|
|
41
|
+
export interface BibliographyItemAttributes {
|
|
20
42
|
id: string;
|
|
21
43
|
type: string;
|
|
22
|
-
author?:
|
|
23
|
-
issued?:
|
|
44
|
+
author?: BibliographyItemAuthor[];
|
|
45
|
+
issued?: BibliographyItemDate;
|
|
24
46
|
containerTitle?: string;
|
|
25
47
|
doi?: string;
|
|
26
48
|
volume?: string;
|
|
@@ -29,9 +51,10 @@ interface Attrs {
|
|
|
29
51
|
page?: string;
|
|
30
52
|
title?: string;
|
|
31
53
|
literal?: string;
|
|
54
|
+
paragraphStyle?: string;
|
|
32
55
|
}
|
|
33
56
|
export interface BibliographyItemNode extends ManuscriptNode {
|
|
34
|
-
attrs:
|
|
57
|
+
attrs: BibliographyItemAttributes;
|
|
35
58
|
}
|
|
36
59
|
export declare const bibliographyItem: NodeSpec;
|
|
37
60
|
export {};
|
|
@@ -13,4 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
interface Attrs {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}
|
|
22
|
+
export interface BoxElementNode extends ManuscriptNode {
|
|
23
|
+
attrs: Attrs;
|
|
24
|
+
}
|
|
25
|
+
export declare const box_element: NodeSpec;
|
|
16
26
|
export {};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { BibliographicName } from '@manuscripts/json-schema';
|
|
2
2
|
import { NodeSpec } from 'prosemirror-model';
|
|
3
3
|
import { ManuscriptNode } from '../types';
|
|
4
|
+
export type ContributorCorresp = {
|
|
5
|
+
correspID: string;
|
|
6
|
+
correspLabel: string;
|
|
7
|
+
};
|
|
8
|
+
export type ContributorFootnote = {
|
|
9
|
+
noteID: string;
|
|
10
|
+
noteLabel: string;
|
|
11
|
+
};
|
|
4
12
|
interface Attrs {
|
|
5
13
|
id: string;
|
|
6
14
|
role: string;
|
|
15
|
+
corresp: ContributorCorresp[];
|
|
7
16
|
affiliations: string[];
|
|
8
17
|
bibliographicName: BibliographicName;
|
|
9
18
|
userID: string;
|
|
@@ -13,6 +22,7 @@ interface Attrs {
|
|
|
13
22
|
ORCIDIdentifier: string;
|
|
14
23
|
priority: number;
|
|
15
24
|
isJointContributor: boolean;
|
|
25
|
+
footnote: ContributorFootnote[];
|
|
16
26
|
}
|
|
17
27
|
export interface ContributorNode extends ManuscriptNode {
|
|
18
28
|
attrs: Attrs;
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNodeType } from '../schema';
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
export declare enum ExtraObjectTypes {
|
|
19
|
+
PlaceholderElement = "MPPlaceholderElement",
|
|
20
|
+
GeneralTableFootnote = "MPGeneralTableFootnote"
|
|
21
|
+
}
|
|
20
22
|
export declare const generateID: (objectType: ObjectTypes | ExtraObjectTypes) => string;
|
|
23
|
+
export declare const generateNodeID: (type: ManuscriptNodeType) => string;
|