@manuscripts/transform 2.3.38-LEAN-3911.0 → 2.4.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/__tests__/data/project-dump.json +825 -0
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/jats/importer/index.js +22 -0
- package/dist/cjs/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +34 -273
- package/dist/cjs/jats/importer/jats-body-transformations.js +22 -74
- package/dist/cjs/jats/importer/jats-comments.js +104 -27
- package/dist/cjs/jats/importer/jats-front-parser.js +321 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +1 -8
- package/dist/cjs/jats/importer/jats-parser-utils.js +5 -43
- package/dist/cjs/jats/importer/jats-reference-parser.js +23 -16
- package/dist/cjs/jats/importer/jats-references.js +18 -18
- package/dist/cjs/jats/importer/parse-jats-article.js +79 -40
- package/dist/cjs/jats/index.js +7 -7
- package/dist/cjs/jats/{exporter/jats-exporter.js → jats-exporter.js} +398 -264
- package/dist/cjs/jats/{exporter/jats-versions.js → jats-versions.js} +3 -1
- package/dist/cjs/lib/utils.js +1 -12
- package/dist/cjs/transformer/__tests__/__helpers__/doc.js +37 -0
- package/dist/cjs/transformer/builders.js +219 -0
- package/dist/cjs/transformer/decode.js +898 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +674 -0
- package/dist/cjs/{jats/importer/create-article-node.js → transformer/filename.js} +9 -10
- package/dist/cjs/transformer/footnote-category.js +20 -0
- package/dist/cjs/transformer/footnotes-order.js +60 -0
- package/dist/cjs/transformer/highlight-markers.js +138 -0
- package/dist/cjs/transformer/html.js +400 -0
- package/dist/cjs/transformer/id.js +5 -10
- package/dist/cjs/transformer/index.js +18 -0
- package/dist/cjs/{jats/exporter → transformer}/labels.js +5 -4
- package/dist/cjs/transformer/manuscript-dependencies.js +21 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/{lib/deafults.js → transformer/models.js} +1 -3
- package/dist/cjs/transformer/node-names.js +1 -0
- package/dist/cjs/transformer/object-types.js +57 -0
- package/dist/cjs/transformer/project-bundle.js +94 -0
- package/dist/cjs/transformer/serializer.js +23 -0
- package/dist/cjs/transformer/timestamp.js +20 -0
- package/dist/cjs/transformer/update-identifiers.js +93 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/__tests__/data/project-dump.json +825 -0
- package/dist/es/index.js +5 -5
- package/dist/{types/jats/importer/create-article-node.d.ts → es/jats/importer/index.js} +2 -3
- package/dist/es/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +35 -274
- package/dist/es/jats/importer/jats-body-transformations.js +22 -74
- package/dist/es/jats/importer/jats-comments.js +101 -26
- package/dist/es/jats/importer/jats-front-parser.js +315 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +0 -6
- package/dist/es/jats/importer/jats-parser-utils.js +6 -44
- package/dist/es/jats/importer/jats-reference-parser.js +23 -16
- package/dist/es/jats/importer/jats-references.js +18 -18
- package/dist/es/jats/importer/parse-jats-article.js +78 -41
- package/dist/es/jats/index.js +3 -5
- package/dist/es/jats/{exporter/jats-exporter.js → jats-exporter.js} +392 -258
- package/dist/es/jats/{exporter/jats-versions.js → jats-versions.js} +1 -0
- package/dist/es/lib/utils.js +0 -9
- package/dist/es/transformer/__tests__/__helpers__/doc.js +29 -0
- package/dist/es/transformer/builders.js +186 -0
- package/dist/es/transformer/decode.js +888 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +664 -0
- package/dist/es/transformer/filename.js +23 -0
- package/dist/es/transformer/footnote-category.js +16 -0
- package/dist/es/transformer/footnotes-order.js +55 -0
- package/dist/es/transformer/highlight-markers.js +132 -0
- package/dist/es/transformer/html.js +393 -0
- package/dist/es/transformer/id.js +3 -8
- package/dist/es/transformer/index.js +16 -0
- package/dist/es/{jats/exporter → transformer}/labels.js +5 -4
- package/dist/es/transformer/manuscript-dependencies.js +17 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/{lib/deafults.js → transformer/models.js} +2 -2
- package/dist/es/transformer/node-names.js +1 -0
- package/dist/es/transformer/object-types.js +52 -0
- package/dist/es/transformer/project-bundle.js +85 -0
- package/dist/es/transformer/serializer.js +17 -0
- package/dist/es/transformer/timestamp.js +16 -0
- package/dist/es/transformer/update-identifiers.js +87 -0
- package/dist/es/version.js +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/jats/importer/index.d.ts +16 -0
- package/dist/types/jats/importer/{jats-dom-parser.d.ts → jats-body-dom-parser.d.ts} +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -5
- package/dist/types/jats/importer/jats-comments.d.ts +10 -4
- package/dist/types/jats/importer/jats-front-parser.d.ts +84 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +0 -10
- package/dist/types/jats/importer/jats-references.d.ts +8 -19
- package/dist/types/jats/importer/parse-jats-article.d.ts +5 -12
- package/dist/types/jats/index.d.ts +3 -5
- package/dist/types/jats/{exporter/jats-exporter.d.ts → jats-exporter.d.ts} +29 -15
- package/dist/types/jats/{exporter/jats-versions.d.ts → jats-versions.d.ts} +1 -0
- package/dist/types/lib/utils.d.ts +0 -2
- package/dist/types/schema/nodes/bibliography_item.d.ts +3 -3
- package/dist/types/schema/nodes/contributor.d.ts +0 -10
- package/dist/types/schema/nodes/keyword_group.d.ts +0 -1
- package/dist/types/schema/nodes/manuscript.d.ts +7 -8
- package/dist/types/schema/nodes/title.d.ts +3 -0
- package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +18 -0
- package/dist/types/transformer/builders.d.ts +61 -0
- package/dist/types/transformer/decode.d.ts +52 -0
- package/dist/types/transformer/document-object-types.d.ts +17 -0
- package/dist/types/transformer/encode.d.ts +29 -0
- package/dist/types/transformer/filename.d.ts +16 -0
- package/dist/types/transformer/footnote-category.d.ts +17 -0
- package/dist/{es/jats/importer/create-article-node.js → types/transformer/footnotes-order.d.ts} +8 -10
- package/dist/types/transformer/highlight-markers.d.ts +31 -0
- package/dist/types/transformer/html.d.ts +36 -0
- package/dist/types/transformer/id.d.ts +2 -5
- package/dist/types/transformer/index.d.ts +16 -0
- package/dist/types/{jats/exporter → transformer}/labels.d.ts +2 -2
- package/dist/types/transformer/manuscript-dependencies.d.ts +4 -0
- package/dist/types/transformer/model-map.d.ts +19 -0
- package/dist/types/transformer/models.d.ts +48 -0
- package/dist/types/transformer/object-types.d.ts +30 -0
- package/dist/types/transformer/project-bundle.d.ts +30 -0
- package/dist/types/transformer/serializer.d.ts +19 -0
- package/dist/types/{lib/deafults.d.ts → transformer/timestamp.d.ts} +2 -2
- package/dist/types/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -2
- package/dist/cjs/jats/importer/jats-front-transformations.js +0 -79
- package/dist/es/jats/importer/jats-front-transformations.js +0 -76
- package/dist/types/jats/importer/jats-front-transformations.d.ts +0 -22
- package/dist/types/jats/types.d.ts +0 -1
- /package/dist/cjs/{jats/types.js → types.js} +0 -0
- /package/dist/es/{jats/types.js → types.js} +0 -0
|
@@ -13,13 +13,18 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { CitationProvider } from '@manuscripts/library';
|
|
18
18
|
import { DOMSerializer } from 'prosemirror-model';
|
|
19
|
-
import { CitationNode, ManuscriptNode } from '
|
|
20
|
-
import {
|
|
19
|
+
import { CitationNode, ManuscriptFragment, ManuscriptNode } from '../schema';
|
|
20
|
+
import { Target } from '../transformer/labels';
|
|
21
|
+
import { IDGenerator, MediaPathGenerator } from '../types';
|
|
21
22
|
import { Version } from './jats-versions';
|
|
22
|
-
|
|
23
|
+
interface Links {
|
|
24
|
+
self?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
23
28
|
export declare const createCounter: () => {
|
|
24
29
|
increment: (field: string) => number;
|
|
25
30
|
};
|
|
@@ -27,11 +32,17 @@ export type CSLOptions = {
|
|
|
27
32
|
style: string;
|
|
28
33
|
locale: string;
|
|
29
34
|
};
|
|
30
|
-
export
|
|
31
|
-
version?: Version;
|
|
32
|
-
journal?: Journal;
|
|
35
|
+
export interface JATSExporterOptions {
|
|
33
36
|
csl: CSLOptions;
|
|
34
|
-
|
|
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
|
+
}
|
|
35
46
|
export declare const buildCitations: (citations: CitationNode[]) => {
|
|
36
47
|
citationID: string;
|
|
37
48
|
citationItems: {
|
|
@@ -43,12 +54,13 @@ export declare const buildCitations: (citations: CitationNode[]) => {
|
|
|
43
54
|
}[];
|
|
44
55
|
export declare class JATSExporter {
|
|
45
56
|
protected document: Document;
|
|
57
|
+
protected modelMap: Map<string, Model>;
|
|
58
|
+
protected models: Model[];
|
|
46
59
|
protected serializer: DOMSerializer;
|
|
47
60
|
protected labelTargets?: Map<string, Target>;
|
|
48
61
|
protected citationTexts: Map<string, string>;
|
|
49
62
|
protected citationProvider: CitationProvider;
|
|
50
|
-
protected
|
|
51
|
-
protected generateCitations(): {
|
|
63
|
+
protected generateCitations(fragment: ManuscriptFragment): {
|
|
52
64
|
citationID: string;
|
|
53
65
|
citationItems: {
|
|
54
66
|
id: string;
|
|
@@ -57,19 +69,20 @@ export declare class JATSExporter {
|
|
|
57
69
|
noteIndex: number;
|
|
58
70
|
};
|
|
59
71
|
}[];
|
|
60
|
-
protected
|
|
61
|
-
|
|
62
|
-
serializeToJATS: (manuscriptNode: ManuscriptNode, options: ExportOptions) => Promise<string>;
|
|
72
|
+
protected generateCitationTexts(fragment: ManuscriptFragment, csl: CSLOptions): void;
|
|
73
|
+
serializeToJATS: (fragment: ManuscriptFragment, modelMap: Map<string, Model>, manuscriptID: string, options: JATSExporterOptions) => Promise<string>;
|
|
63
74
|
private nodeFromJATS;
|
|
75
|
+
protected rewriteMediaPaths: (generator: MediaPathGenerator) => Promise<void>;
|
|
64
76
|
protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
|
|
65
77
|
protected setTitleContent: (element: HTMLElement, title: string) => void;
|
|
66
|
-
protected buildFront: (
|
|
78
|
+
protected buildFront: (doi?: string, id?: string, links?: Links) => HTMLElement;
|
|
67
79
|
protected buildDateElement: (timestamp: number, type: string) => HTMLElement;
|
|
68
80
|
protected buildCountingElement: (tagName: string, count: number | undefined) => HTMLElement | undefined;
|
|
69
|
-
protected buildBody: () => HTMLBodyElement;
|
|
81
|
+
protected buildBody: (fragment: ManuscriptFragment) => HTMLBodyElement;
|
|
70
82
|
protected buildBack: (body: HTMLElement) => HTMLElement;
|
|
71
83
|
protected createSerializer: () => void;
|
|
72
84
|
private createEquation;
|
|
85
|
+
protected serializeFragment: (fragment: ManuscriptFragment) => HTMLElement | DocumentFragment;
|
|
73
86
|
protected serializeNode: (node: ManuscriptNode) => Node;
|
|
74
87
|
private validateContributor;
|
|
75
88
|
private buildContributors;
|
|
@@ -96,3 +109,4 @@ export declare class JATSExporter {
|
|
|
96
109
|
private fillEmptyFootnotes;
|
|
97
110
|
private fillEmptyTableFooters;
|
|
98
111
|
}
|
|
112
|
+
export {};
|
|
@@ -26,5 +26,3 @@ 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 timestamp: () => number;
|
|
30
|
-
export declare const generateAttachmentFilename: (id: string, contentType?: string) => string;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { BibliographicDate, BibliographicName } from '@manuscripts/json-schema';
|
|
17
17
|
import { NodeSpec } from 'prosemirror-model';
|
|
18
18
|
import { ManuscriptNode } from '../types';
|
|
19
|
-
|
|
19
|
+
interface Attrs {
|
|
20
20
|
id: string;
|
|
21
21
|
type: string;
|
|
22
22
|
author?: BibliographicName[];
|
|
@@ -29,9 +29,9 @@ export interface BibliographyItemAttrs {
|
|
|
29
29
|
page?: string;
|
|
30
30
|
title?: string;
|
|
31
31
|
literal?: string;
|
|
32
|
-
paragraphStyle?: string;
|
|
33
32
|
}
|
|
34
33
|
export interface BibliographyItemNode extends ManuscriptNode {
|
|
35
|
-
attrs:
|
|
34
|
+
attrs: Attrs;
|
|
36
35
|
}
|
|
37
36
|
export declare const bibliographyItem: NodeSpec;
|
|
37
|
+
export {};
|
|
@@ -1,18 +1,9 @@
|
|
|
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
|
-
};
|
|
12
4
|
interface Attrs {
|
|
13
5
|
id: string;
|
|
14
6
|
role: string;
|
|
15
|
-
corresp: ContributorCorresp[];
|
|
16
7
|
affiliations: string[];
|
|
17
8
|
bibliographicName: BibliographicName;
|
|
18
9
|
userID: string;
|
|
@@ -22,7 +13,6 @@ interface Attrs {
|
|
|
22
13
|
ORCIDIdentifier: string;
|
|
23
14
|
priority: number;
|
|
24
15
|
isJointContributor: boolean;
|
|
25
|
-
footnote: ContributorFootnote[];
|
|
26
16
|
}
|
|
27
17
|
export interface ContributorNode extends ManuscriptNode {
|
|
28
18
|
attrs: Attrs;
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
18
|
export interface ActualManuscriptNode extends ManuscriptNode {
|
|
19
|
-
attrs:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
primaryLanguageCode: string;
|
|
19
|
+
attrs: {
|
|
20
|
+
id: string;
|
|
21
|
+
doi: string;
|
|
22
|
+
articleType: string;
|
|
23
|
+
prototype: string;
|
|
24
|
+
primaryLanguageCode: string;
|
|
25
|
+
};
|
|
27
26
|
}
|
|
28
27
|
export declare const manuscript: NodeSpec;
|
|
29
28
|
export declare const isManuscriptNode: (node: ManuscriptNode) => node is import("prosemirror-model").Node;
|
|
@@ -17,6 +17,9 @@ import { NodeSpec } from 'prosemirror-model';
|
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
18
|
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle: string;
|
|
22
|
+
runningTitle: string;
|
|
20
23
|
placeholder: string;
|
|
21
24
|
}
|
|
22
25
|
export interface TitleNode extends ManuscriptNode {
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
|
+
export declare const createTestModelMap: () => Map<string, Model>;
|
|
18
|
+
export declare const createTestDoc: () => import("prosemirror-model").Node;
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
import { Affiliation, Attribution, AuthorNotes, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
|
|
17
|
+
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
|
+
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
|
+
export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
|
|
20
|
+
_id: string;
|
|
21
|
+
objectType: string;
|
|
22
|
+
contributions?: Contribution[];
|
|
23
|
+
};
|
|
24
|
+
export type BuildEmbedded<T extends EmbeddedModel, O> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
|
|
25
|
+
_id: string;
|
|
26
|
+
objectType: O;
|
|
27
|
+
};
|
|
28
|
+
export declare const buildProject: (owner: string) => Build<Project>;
|
|
29
|
+
export declare const buildManuscript: () => Build<Manuscript>;
|
|
30
|
+
export type ContributorRoleType = 'author';
|
|
31
|
+
export declare const buildContributor: (bibliographicName: BibliographicName, role?: ContributorRoleType, priority?: number, userID?: string, invitationID?: string) => Build<Contributor>;
|
|
32
|
+
export declare const buildBibliographyItem: (data: Partial<Build<BibliographyItem>>) => Build<BibliographyItem>;
|
|
33
|
+
export declare const buildBibliographicName: (data: Partial<BibliographicName>) => BuildEmbedded<BibliographicName, ObjectTypes.BibliographicName>;
|
|
34
|
+
export declare const buildBibliographicDate: (data: Partial<BibliographicDate>) => BuildEmbedded<BibliographicDate, ObjectTypes.BibliographicDate>;
|
|
35
|
+
export declare const buildBibliographyElement: (bibliographyItems: BibliographyItem[]) => Build<BibliographyElement>;
|
|
36
|
+
export declare const buildKeyword: (name: string) => Build<Keyword>;
|
|
37
|
+
export declare const buildKeywordGroup: (attributes: {
|
|
38
|
+
type?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
}) => Build<KeywordGroup>;
|
|
42
|
+
export declare const buildFigure: (blob: Blob) => Build<Figure & ModelAttachment>;
|
|
43
|
+
export declare const buildAffiliation: (institution: string, priority?: number) => Build<Affiliation>;
|
|
44
|
+
export declare const buildSupplementaryMaterial: (title: string, href: string) => Build<Supplement>;
|
|
45
|
+
export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
|
|
46
|
+
export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
|
|
47
|
+
export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
|
|
48
|
+
export declare const buildAuthorNotes: (containedObjectIDs: string[]) => Build<AuthorNotes>;
|
|
49
|
+
export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList, containedObjectID: string) => Build<FootnotesOrder>;
|
|
50
|
+
export declare const buildCorresp: (contents: string) => Build<Corresponding>;
|
|
51
|
+
export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
|
|
52
|
+
export declare const buildParagraph: (innerHTML?: string) => Build<ParagraphElement>;
|
|
53
|
+
export declare const buildColor: (value: string, priority: number) => Build<Color>;
|
|
54
|
+
export declare const buildContribution: (profileID: string) => Contribution;
|
|
55
|
+
export declare const buildContributorRole: (name: string) => Build<ContributorRole>;
|
|
56
|
+
export declare const buildAttribution: () => Build<Attribution>;
|
|
57
|
+
export declare const buildJournal: () => Build<Journal>;
|
|
58
|
+
export type AuxiliaryObjects = 'MPFigureElement' | 'MPTableElement' | 'MPListingElement' | 'MPEquationElement';
|
|
59
|
+
export declare const auxiliaryObjectTypes: Set<import("prosemirror-model").NodeType>;
|
|
60
|
+
export declare const buildElementsOrder: (elementType: AuxiliaryObjects) => Build<ElementsOrder>;
|
|
61
|
+
export declare const buildTitles: (title?: string) => Build<Titles>;
|
|
@@ -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
|
+
import { CommentAnnotation, Model, Section } from '@manuscripts/json-schema';
|
|
17
|
+
import { ParseOptions } from 'prosemirror-model';
|
|
18
|
+
import { ManuscriptNode } from '../schema';
|
|
19
|
+
export declare const getModelData: <T extends Model>(model: Model) => T;
|
|
20
|
+
export declare const getModelsByType: <T extends Model>(modelMap: Map<string, Model>, objectType: string) => T[];
|
|
21
|
+
export declare const sortSectionsByPriority: (a: Section, b: Section) => number;
|
|
22
|
+
export declare class Decoder {
|
|
23
|
+
private readonly modelMap;
|
|
24
|
+
private readonly allowMissingElements;
|
|
25
|
+
private comments;
|
|
26
|
+
private creators;
|
|
27
|
+
private createTitleNode;
|
|
28
|
+
private createAffiliationsNode;
|
|
29
|
+
private createContributorsNode;
|
|
30
|
+
private createAuthorNotesNode;
|
|
31
|
+
private createKeywordsNode;
|
|
32
|
+
private createSupplementsNode;
|
|
33
|
+
private createCommentsNode;
|
|
34
|
+
private createContentSections;
|
|
35
|
+
private createCommentNodes;
|
|
36
|
+
private getComments;
|
|
37
|
+
private extractListing;
|
|
38
|
+
constructor(modelMap: Map<string, Model>, allowMissingElements?: boolean);
|
|
39
|
+
decode: (model: Model) => ManuscriptNode | null;
|
|
40
|
+
getModel: <T extends Model>(id: string) => T | undefined;
|
|
41
|
+
createArticleNode: (manuscriptID?: string) => ManuscriptNode;
|
|
42
|
+
addGeneratedLabels: (sections: Section[]) => Section[];
|
|
43
|
+
parseContents: (contents: string, wrapper?: string, commentAnnotations?: CommentAnnotation[], options?: ParseOptions) => ManuscriptNode;
|
|
44
|
+
private getManuscriptID;
|
|
45
|
+
private getManuscript;
|
|
46
|
+
private getBoxElementFigCaption;
|
|
47
|
+
private getFigcaption;
|
|
48
|
+
private createTable;
|
|
49
|
+
private createTableColGroup;
|
|
50
|
+
private createTableElementFooter;
|
|
51
|
+
private createListing;
|
|
52
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
|
+
export declare const documentObjectTypes: ObjectTypes[];
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
|
+
import { ManuscriptNode } from '../schema';
|
|
18
|
+
import { CommentMarker } from './highlight-markers';
|
|
19
|
+
export declare const inlineContents: (node: ManuscriptNode) => string;
|
|
20
|
+
export declare const inlineText: (node: ManuscriptNode) => string;
|
|
21
|
+
export declare const modelFromNode: (node: ManuscriptNode, parent: ManuscriptNode, path: string[], priority: PrioritizedValue) => {
|
|
22
|
+
model: Model;
|
|
23
|
+
markers: CommentMarker[];
|
|
24
|
+
};
|
|
25
|
+
interface PrioritizedValue {
|
|
26
|
+
value: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const encode: (node: ManuscriptNode) => Map<string, Model>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 declare const generateAttachmentFilename: (id: string, contentType?: string) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2021 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 type FootnoteType = 'con' | 'conflict' | 'deceased' | 'equal' | 'financial-disclosure' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by';
|
|
17
|
+
export declare const buildFootnoteCategory: (category: string) => string | undefined;
|
package/dist/{es/jats/importer/create-article-node.js → types/transformer/footnotes-order.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2022 Atypon Systems LLC
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -13,12 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return schema.nodes.manuscript.createAndFill(attrs, title);
|
|
24
|
-
};
|
|
16
|
+
import { FootnotesOrder } from '@manuscripts/json-schema';
|
|
17
|
+
export type FootnotesOrderIndexList = {
|
|
18
|
+
id: string;
|
|
19
|
+
index: number;
|
|
20
|
+
}[];
|
|
21
|
+
export declare const createOrderedFootnotesIDs: (doc: Document) => string[];
|
|
22
|
+
export declare const handleFootnotesOrder: (orderedFootnotesIDs: Array<string>, replacements: Map<string, string>, footnotesOrder: FootnotesOrder) => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
|
+
export type HighlightableField = 'title' | 'caption' | 'contents';
|
|
18
|
+
export declare const highlightableFields: HighlightableField[];
|
|
19
|
+
export declare const isHighlightableModel: (model: Model) => model is HighlightableModel;
|
|
20
|
+
export interface HighlightableModel extends Model {
|
|
21
|
+
contents?: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
caption?: string;
|
|
24
|
+
}
|
|
25
|
+
export type CommentMarker = {
|
|
26
|
+
_id: string;
|
|
27
|
+
from: number;
|
|
28
|
+
to: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const extractCommentMarkers: (model: Model) => CommentMarker[];
|
|
31
|
+
export declare const insertHighlightMarkers: (contents: string, commentAnnotations: CommentAnnotation[]) => string;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
|
+
import { ManuscriptFragment } from '../schema';
|
|
18
|
+
import { IDGenerator, MediaPathGenerator } from '../types';
|
|
19
|
+
export interface HTMLExporterOptions {
|
|
20
|
+
idGenerator?: IDGenerator;
|
|
21
|
+
mediaPathGenerator?: MediaPathGenerator;
|
|
22
|
+
}
|
|
23
|
+
export declare class HTMLTransformer {
|
|
24
|
+
private document;
|
|
25
|
+
private modelMap;
|
|
26
|
+
private labelTargets?;
|
|
27
|
+
serializeToHTML: (fragment: ManuscriptFragment, modelMap: Map<string, Model>, options?: HTMLExporterOptions) => Promise<string>;
|
|
28
|
+
protected rewriteMediaPaths: (mediaPathGenerator: MediaPathGenerator) => Promise<void>;
|
|
29
|
+
protected rewriteIDs: (idGenerator?: IDGenerator) => Promise<void>;
|
|
30
|
+
private buildFront;
|
|
31
|
+
private buildContributors;
|
|
32
|
+
private buildBody;
|
|
33
|
+
private idSelector;
|
|
34
|
+
private fixFigure;
|
|
35
|
+
private fixBody;
|
|
36
|
+
}
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNodeType } from '../schema';
|
|
18
|
-
|
|
19
|
-
PlaceholderElement = "MPPlaceholderElement",
|
|
20
|
-
GeneralTableFootnote = "MPGeneralTableFootnote"
|
|
21
|
-
}
|
|
22
|
-
export declare const generateID: (objectType: ObjectTypes | ExtraObjectTypes) => string;
|
|
18
|
+
import { ExtraObjectTypes } from './object-types';
|
|
23
19
|
export declare const generateNodeID: (type: ManuscriptNodeType) => string;
|
|
20
|
+
export declare const generateID: (objectType: ObjectTypes | ExtraObjectTypes) => string;
|
|
@@ -13,8 +13,24 @@
|
|
|
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';
|
|
16
23
|
export * from './id';
|
|
24
|
+
export * from './labels';
|
|
25
|
+
export * from './manuscript-dependencies';
|
|
26
|
+
export * from './models';
|
|
17
27
|
export * from './node-names';
|
|
18
28
|
export * from './node-title';
|
|
19
29
|
export * from './node-types';
|
|
30
|
+
export * from './object-types';
|
|
31
|
+
export * from './project-bundle';
|
|
20
32
|
export * from './section-category';
|
|
33
|
+
export * from './serializer';
|
|
34
|
+
export * from './timestamp';
|
|
35
|
+
export * from './update-identifiers';
|
|
36
|
+
export { createTestDoc } from './__tests__/__helpers__/doc';
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ManuscriptFragment
|
|
16
|
+
import { ManuscriptFragment } from '../schema';
|
|
17
17
|
export interface Target {
|
|
18
18
|
type: string;
|
|
19
19
|
id: string;
|
|
20
20
|
label: string;
|
|
21
21
|
caption: string;
|
|
22
22
|
}
|
|
23
|
-
export declare const buildTargets: (
|
|
23
|
+
export declare const buildTargets: (fragment: ManuscriptFragment) => Map<string, Target>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { Model } from '@manuscripts/json-schema';
|
|
17
|
+
import { Build } from './builders';
|
|
18
|
+
export type AddModel = <T extends Model>(data: Partial<T> | Build<T>) => void;
|
|
19
|
+
export declare const addModelToMap: (modelMap: Map<string, Model>) => AddModel;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
import { Model, UserProfile } from '@manuscripts/json-schema';
|
|
17
|
+
import { ManuscriptNode } from '../schema';
|
|
18
|
+
export interface Attachment {
|
|
19
|
+
id: string;
|
|
20
|
+
data: Blob | ArrayBuffer;
|
|
21
|
+
type: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ModelAttachment {
|
|
24
|
+
attachment?: Attachment;
|
|
25
|
+
}
|
|
26
|
+
export type ModelWithAttachment = Model & ModelAttachment;
|
|
27
|
+
export interface UserProfileWithAvatar extends UserProfile {
|
|
28
|
+
avatar?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ContainedProps {
|
|
31
|
+
containerID: string;
|
|
32
|
+
}
|
|
33
|
+
export type ContainedModel = Model & ContainedProps;
|
|
34
|
+
export interface ManuscriptProps {
|
|
35
|
+
manuscriptID: string;
|
|
36
|
+
}
|
|
37
|
+
export type ManuscriptModel = ContainedModel & ManuscriptProps;
|
|
38
|
+
export interface CommentSelector {
|
|
39
|
+
from: number;
|
|
40
|
+
to: number;
|
|
41
|
+
}
|
|
42
|
+
export interface PlaceholderElement extends ContainedModel {
|
|
43
|
+
elementType: 'p';
|
|
44
|
+
}
|
|
45
|
+
export interface Selected {
|
|
46
|
+
pos: number;
|
|
47
|
+
node: ManuscriptNode;
|
|
48
|
+
}
|