@manuscripts/transform 2.3.34-LEAN-3911.2 → 2.3.35
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/jats/importer/index.js +3 -3
- package/dist/cjs/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +9 -229
- package/dist/cjs/jats/importer/jats-body-transformations.js +0 -70
- 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 -39
- package/dist/cjs/jats/importer/jats-reference-parser.js +27 -16
- package/dist/cjs/jats/importer/jats-references.js +18 -18
- package/dist/cjs/jats/importer/parse-jats-article.js +78 -42
- package/dist/cjs/jats/index.js +3 -4
- package/dist/cjs/jats/jats-exporter.js +354 -251
- package/dist/cjs/lib/utils.js +1 -9
- package/dist/cjs/schema/nodes/inline_footnote.js +1 -0
- package/dist/cjs/transformer/__tests__/__helpers__/doc.js +37 -0
- package/dist/cjs/transformer/builders.js +219 -0
- package/dist/cjs/transformer/decode.js +874 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +664 -0
- 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 +6 -6
- package/dist/cjs/transformer/index.js +18 -0
- package/dist/cjs/{jats → transformer}/labels.js +3 -3
- package/dist/cjs/transformer/manuscript-dependencies.js +21 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/transformer/models.js +17 -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/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/jats/importer/index.js +1 -2
- package/dist/es/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +10 -230
- package/dist/es/jats/importer/jats-body-transformations.js +0 -70
- 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 -40
- package/dist/es/jats/importer/jats-reference-parser.js +27 -16
- package/dist/es/jats/importer/jats-references.js +18 -18
- package/dist/es/jats/importer/parse-jats-article.js +77 -43
- package/dist/es/jats/index.js +1 -3
- package/dist/es/jats/jats-exporter.js +356 -253
- package/dist/es/lib/utils.js +0 -7
- package/dist/es/schema/nodes/inline_footnote.js +1 -0
- package/dist/es/transformer/__tests__/__helpers__/doc.js +29 -0
- package/dist/es/transformer/builders.js +186 -0
- package/dist/es/transformer/decode.js +864 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +654 -0
- package/dist/{types/jats/importer/create-article-node.d.ts → es/transformer/footnote-category.js} +2 -3
- 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 +4 -5
- package/dist/es/transformer/index.js +16 -0
- package/dist/es/{jats → transformer}/labels.js +3 -3
- package/dist/es/transformer/manuscript-dependencies.js +17 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/transformer/models.js +16 -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/update-identifiers.js +87 -0
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/index.d.ts +1 -2
- 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 +0 -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 +1 -3
- package/dist/types/jats/jats-exporter.d.ts +29 -10
- package/dist/types/lib/utils.d.ts +0 -3
- package/dist/types/schema/nodes/bibliography_item.d.ts +6 -16
- package/dist/types/schema/nodes/contributor.d.ts +0 -10
- package/dist/types/schema/nodes/keyword_group.d.ts +0 -1
- 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 +51 -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/footnote-category.d.ts +17 -0
- package/dist/types/transformer/footnotes-order.d.ts +22 -0
- 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 +3 -4
- package/dist/types/transformer/index.d.ts +16 -0
- package/dist/types/{jats → transformer}/labels.d.ts +1 -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/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -2
- package/dist/cjs/jats/importer/create-article-node.js +0 -31
- package/dist/cjs/jats/importer/jats-front-transformations.js +0 -262
- package/dist/es/jats/importer/create-article-node.js +0 -27
- package/dist/es/jats/importer/jats-front-transformations.js +0 -259
- package/dist/types/jats/importer/jats-front-transformations.d.ts +0 -38
- /package/dist/cjs/{jats → transformer}/filename.js +0 -0
- /package/dist/cjs/{jats → transformer}/timestamp.js +0 -0
- /package/dist/es/{jats → transformer}/filename.js +0 -0
- /package/dist/es/{jats → transformer}/timestamp.js +0 -0
- /package/dist/types/{jats → transformer}/filename.d.ts +0 -0
- /package/dist/types/{jats → transformer}/timestamp.d.ts +0 -0
|
@@ -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;
|
|
@@ -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,51 @@
|
|
|
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 getFigcaption;
|
|
47
|
+
private createTable;
|
|
48
|
+
private createTableColGroup;
|
|
49
|
+
private createTableElementFooter;
|
|
50
|
+
private createListing;
|
|
51
|
+
}
|
|
@@ -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,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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2022 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 { 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
|
+
}
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
17
|
+
import { ManuscriptNodeType } from '../schema';
|
|
18
|
+
import { ExtraObjectTypes } from './object-types';
|
|
19
|
+
export declare const generateNodeID: (type: ManuscriptNodeType) => string;
|
|
21
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,7 +13,6 @@
|
|
|
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';
|
|
17
16
|
import { ManuscriptFragment } from '../schema';
|
|
18
17
|
export interface Target {
|
|
19
18
|
type: string;
|
|
@@ -21,4 +20,4 @@ export interface Target {
|
|
|
21
20
|
label: string;
|
|
22
21
|
caption: string;
|
|
23
22
|
}
|
|
24
|
-
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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, Figure, Keyword, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
|
|
17
|
+
import { ManuscriptModel } from './models';
|
|
18
|
+
export declare enum ExtraObjectTypes {
|
|
19
|
+
PlaceholderElement = "MPPlaceholderElement",
|
|
20
|
+
GeneralTableFootnote = "MPGeneralTableFootnote"
|
|
21
|
+
}
|
|
22
|
+
export declare const elementObjects: ObjectTypes[];
|
|
23
|
+
export declare const manuscriptObjects: ObjectTypes[];
|
|
24
|
+
export declare const isManuscriptModel: (model: Model) => model is ManuscriptModel;
|
|
25
|
+
export declare const hasObjectType: <T extends Model>(objectType: string) => (model: Model) => model is T;
|
|
26
|
+
export declare const isFigure: (model: Model) => model is Figure;
|
|
27
|
+
export declare const isManuscript: (model: Model) => model is Manuscript;
|
|
28
|
+
export declare const isTable: (model: Model) => model is Table;
|
|
29
|
+
export declare const isCommentAnnotation: (model: Model) => model is CommentAnnotation;
|
|
30
|
+
export declare const isKeyword: (model: Model) => model is Keyword;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { Journal, Manuscript, Model, ObjectTypes, Titles } from '@manuscripts/json-schema';
|
|
17
|
+
import { ManuscriptModel } from './models';
|
|
18
|
+
export interface ProjectBundle {
|
|
19
|
+
version: string;
|
|
20
|
+
data: Model[];
|
|
21
|
+
}
|
|
22
|
+
export declare const parseProjectBundle: (projectBundle: ProjectBundle, manuscriptID?: string) => {
|
|
23
|
+
doc: import("prosemirror-model").Node;
|
|
24
|
+
modelMap: Map<string, Model>;
|
|
25
|
+
};
|
|
26
|
+
export declare const findManuscript: (modelMap: Map<string, Model>) => Manuscript;
|
|
27
|
+
export declare const findJournal: (modelMap: Map<string, Model>) => Journal | null;
|
|
28
|
+
export declare const findManuscriptModelByType: <T extends ManuscriptModel>(modelMap: Map<string, Model>, manuscript: Manuscript, objectType: ObjectTypes) => T | undefined;
|
|
29
|
+
export declare const findManuscriptById: (modelMap: Map<string, Model>, manuscriptID: string) => Manuscript;
|
|
30
|
+
export declare const findTitles: (modelMap: Map<string, Model>) => Titles;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 serializeToString from 'w3c-xmlserializer';
|
|
17
|
+
export declare const xmlSerializer: {
|
|
18
|
+
serializeToString: typeof serializeToString;
|
|
19
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 JSZip from 'jszip';
|
|
18
|
+
export declare const updateIdentifiers: (data: Model[]) => Promise<{
|
|
19
|
+
data: Model[];
|
|
20
|
+
idMap: Map<string, string>;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const updateAttachmentPath: (oldPath: string, idMap: Map<string, string>) => string | undefined;
|
|
23
|
+
export declare const updateAttachments: (zip: JSZip, idMap: Map<string, string>) => Promise<void>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.35";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.35",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"mime": "^3.0.0",
|
|
39
39
|
"prosemirror-model": "^1.18.3",
|
|
40
40
|
"prosemirror-tables": "^1.3.5",
|
|
41
|
-
"prosemirror-utils": "^1.2.2",
|
|
42
41
|
"semver": "^7.6.2",
|
|
43
42
|
"uuid": "^9.0.0",
|
|
44
43
|
"w3c-xmlserializer": "^4.0.0"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2024 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createArticleNode = void 0;
|
|
19
|
-
const schema_1 = require("../../schema");
|
|
20
|
-
const jats_front_transformations_1 = require("./jats-front-transformations");
|
|
21
|
-
const createArticleNode = (manuscript) => {
|
|
22
|
-
const title = schema_1.schema.nodes.title.createChecked({}, schema_1.schema.text(jats_front_transformations_1.defaultTitle));
|
|
23
|
-
return schema_1.schema.nodes.manuscript.createAndFill({
|
|
24
|
-
id: manuscript._id,
|
|
25
|
-
doi: manuscript.DOI,
|
|
26
|
-
articleType: manuscript.articleType,
|
|
27
|
-
prototype: manuscript.prototype,
|
|
28
|
-
primaryLanguageCode: manuscript.primaryLanguageCode,
|
|
29
|
-
}, title);
|
|
30
|
-
};
|
|
31
|
-
exports.createArticleNode = createArticleNode;
|