@manuscripts/transform 1.5.3 → 1.5.4-LEAN-3030
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/jats-body-dom-parser.js +23 -18
- package/dist/cjs/jats/importer/jats-body-transformations.js +3 -3
- package/dist/cjs/jats/importer/parse-jats-article.js +11 -2
- package/dist/cjs/jats/jats-exporter.js +19 -12
- package/dist/cjs/lib/utils.js +10 -1
- package/dist/cjs/schema/index.js +19 -12
- package/dist/cjs/schema/nodes/affiliations.js +15 -0
- package/dist/cjs/schema/nodes/contributors.js +15 -0
- package/dist/cjs/schema/nodes/core_section.js +27 -0
- package/dist/cjs/schema/nodes/keyword.js +0 -1
- package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
- package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
- package/dist/cjs/schema/nodes/keywords_element.js +1 -1
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/title.js +29 -0
- package/dist/cjs/transformer/builders.js +8 -3
- package/dist/cjs/transformer/decode.js +119 -105
- package/dist/cjs/transformer/encode.js +19 -26
- package/dist/cjs/transformer/html.js +6 -5
- package/dist/cjs/transformer/node-names.js +1 -1
- package/dist/cjs/transformer/node-title.js +7 -5
- package/dist/cjs/transformer/node-types.js +8 -4
- package/dist/cjs/transformer/project-bundle.js +22 -1
- package/dist/cjs/transformer/section-category.js +35 -8
- package/dist/es/jats/importer/jats-body-dom-parser.js +23 -18
- package/dist/es/jats/importer/jats-body-transformations.js +3 -3
- package/dist/es/jats/importer/parse-jats-article.js +11 -2
- package/dist/es/jats/jats-exporter.js +20 -13
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/schema/index.js +19 -12
- package/dist/es/schema/nodes/{affiliations_section.js → affiliations.js} +3 -3
- package/dist/es/schema/nodes/{contributors_section.js → contributors.js} +3 -3
- package/dist/es/schema/nodes/core_section.js +24 -0
- package/dist/es/schema/nodes/keyword.js +0 -1
- package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
- package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
- package/dist/es/schema/nodes/keywords_element.js +1 -1
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/title.js +26 -0
- package/dist/es/transformer/builders.js +6 -2
- package/dist/es/transformer/decode.js +120 -106
- package/dist/es/transformer/encode.js +19 -26
- package/dist/es/transformer/html.js +7 -6
- package/dist/es/transformer/node-names.js +1 -1
- package/dist/es/transformer/node-title.js +8 -6
- package/dist/es/transformer/node-types.js +8 -4
- package/dist/es/transformer/project-bundle.js +20 -0
- package/dist/es/transformer/section-category.js +33 -7
- package/dist/types/lib/utils.d.ts +1 -0
- package/dist/types/schema/index.d.ts +4 -3
- package/dist/types/schema/nodes/affiliations.d.ts +11 -0
- package/dist/types/schema/nodes/contributors.d.ts +11 -0
- package/dist/types/schema/nodes/core_section.d.ts +17 -0
- package/dist/types/schema/nodes/keyword.d.ts +0 -1
- package/dist/types/schema/nodes/{keywords_group.d.ts → keyword_group.d.ts} +3 -3
- package/dist/types/schema/nodes/{keywords_section.d.ts → keywords.d.ts} +3 -3
- package/dist/types/schema/nodes/title.d.ts +28 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +3 -2
- package/dist/types/transformer/decode.d.ts +6 -5
- package/dist/types/transformer/project-bundle.d.ts +2 -1
- package/dist/types/transformer/section-category.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/schema/nodes/affiliations_section.js +0 -15
- package/dist/cjs/schema/nodes/contributors_section.js +0 -15
- package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
- package/dist/types/schema/nodes/contributors_section.d.ts +0 -11
|
@@ -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 { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
export declare const coreSection: NodeSpec;
|
|
@@ -18,9 +18,9 @@ import { ManuscriptNode } from '../types';
|
|
|
18
18
|
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
21
|
+
export interface KeywordGroupNode extends ManuscriptNode {
|
|
22
22
|
attrs: Attrs;
|
|
23
23
|
}
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
24
|
+
export declare const keywordGroup: NodeSpec;
|
|
25
|
+
export declare const isKeywordGroupNode: (node: ManuscriptNode) => node is KeywordGroupNode;
|
|
26
26
|
export {};
|
|
@@ -18,9 +18,9 @@ import { ManuscriptNode } from '../types';
|
|
|
18
18
|
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
21
|
+
export interface KeywordsNode extends ManuscriptNode {
|
|
22
22
|
attrs: Attrs;
|
|
23
23
|
}
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
24
|
+
export declare const keywords: NodeSpec;
|
|
25
|
+
export declare const isKeywordsNode: (node: ManuscriptNode) => node is KeywordsNode;
|
|
26
26
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
interface Attrs {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle: string;
|
|
22
|
+
runningTitle: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TitleNode extends ManuscriptNode {
|
|
25
|
+
attrs: Attrs;
|
|
26
|
+
}
|
|
27
|
+
export declare const title: NodeSpec;
|
|
28
|
+
export {};
|
|
@@ -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' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | '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' | '
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | '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' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'meta_section' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Supplement, UserProfileAffiliation } from '@manuscripts/json-schema';
|
|
16
|
+
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Supplement, Titles, UserProfileAffiliation } from '@manuscripts/json-schema';
|
|
17
17
|
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
18
|
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
19
|
export declare const DEFAULT_BUNDLE = "MPBundle:www-zotero-org-styles-nature";
|
|
@@ -28,7 +28,7 @@ export type BuildEmbedded<T extends EmbeddedModel, O> = Pick<T, Exclude<keyof T,
|
|
|
28
28
|
objectType: O;
|
|
29
29
|
};
|
|
30
30
|
export declare const buildProject: (owner: string) => Build<Project>;
|
|
31
|
-
export declare const buildManuscript: (
|
|
31
|
+
export declare const buildManuscript: () => Build<Manuscript>;
|
|
32
32
|
export type ContributorRoleType = 'author';
|
|
33
33
|
export declare const buildContributor: (bibliographicName: BibliographicName, role?: ContributorRoleType, priority?: number, userID?: string, invitationID?: string) => Build<Contributor>;
|
|
34
34
|
export declare const buildBibliographyItem: (data: Partial<Build<BibliographyItem>>) => Build<BibliographyItem>;
|
|
@@ -70,3 +70,4 @@ export declare const buildStatusLabel: (name: string) => Build<StatusLabel>;
|
|
|
70
70
|
export type AuxiliaryObjects = 'MPFigureElement' | 'MPTableElement' | 'MPListingElement' | 'MPEquationElement';
|
|
71
71
|
export declare const auxiliaryObjectTypes: Set<import("prosemirror-model").NodeType>;
|
|
72
72
|
export declare const buildElementsOrder: (elementType: AuxiliaryObjects) => Build<ElementsOrder>;
|
|
73
|
+
export declare const buildTitles: (title?: string) => Build<Titles>;
|
|
@@ -25,12 +25,15 @@ export declare class Decoder {
|
|
|
25
25
|
private readonly allowMissingElements;
|
|
26
26
|
private comments;
|
|
27
27
|
private creators;
|
|
28
|
+
private createTitleNode;
|
|
29
|
+
private createAffiliationsNode;
|
|
30
|
+
private createContributorsNode;
|
|
31
|
+
private createKeywordsNode;
|
|
28
32
|
private createMetaSectionNode;
|
|
29
33
|
private createCommentListNode;
|
|
30
|
-
private handleMissingRootSectionNodes;
|
|
31
|
-
private createAffiliationSectionNode;
|
|
32
|
-
private createContributorSectionNode;
|
|
33
34
|
private createRootSectionNodes;
|
|
35
|
+
private ensureCoreSectionsExist;
|
|
36
|
+
private createAndFill;
|
|
34
37
|
private createCommentsNode;
|
|
35
38
|
private getComments;
|
|
36
39
|
private extractListing;
|
|
@@ -40,11 +43,9 @@ export declare class Decoder {
|
|
|
40
43
|
createArticleNode: (manuscriptID?: string) => ManuscriptNode;
|
|
41
44
|
addGeneratedLabels: (sections: Section[]) => Section[];
|
|
42
45
|
parseContents: (contents: string, wrapper?: string, commentAnnotations?: CommentAnnotation[], options?: ParseOptions) => ManuscriptNode;
|
|
43
|
-
private getKeywords;
|
|
44
46
|
private getManuscriptID;
|
|
45
47
|
private getFigcaption;
|
|
46
48
|
private createTable;
|
|
47
49
|
private createTableElementFooter;
|
|
48
50
|
private createListing;
|
|
49
|
-
private getKeywordGroups;
|
|
50
51
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Journal, Manuscript, Model, ObjectTypes } from '@manuscripts/json-schema';
|
|
16
|
+
import { Journal, Manuscript, Model, ObjectTypes, Titles } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel } from './models';
|
|
18
18
|
export interface ProjectBundle {
|
|
19
19
|
version: string;
|
|
@@ -27,3 +27,4 @@ export declare const findManuscript: (modelMap: Map<string, Model>) => Manuscrip
|
|
|
27
27
|
export declare const findJournal: (modelMap: Map<string, Model>) => Journal | null;
|
|
28
28
|
export declare const findManuscriptModelByType: <T extends ManuscriptModel>(modelMap: Map<string, Model>, manuscript: Manuscript, objectType: ObjectTypes) => T | undefined;
|
|
29
29
|
export declare const findManuscriptById: (modelMap: Map<string, Model>, manuscriptID: string) => Manuscript;
|
|
30
|
+
export declare const findTitles: (modelMap: Map<string, Model>) => Titles;
|
|
@@ -25,6 +25,7 @@ export declare const guessSectionCategory: (elements: Element[]) => SectionCateg
|
|
|
25
25
|
export declare const buildSectionCategory: (node: ManuscriptNode) => SectionCategory | undefined;
|
|
26
26
|
export declare const chooseJatsFnType: (footnoteType: string) => string;
|
|
27
27
|
export declare const chooseSecType: (sectionCategory: SectionCategory) => SecType;
|
|
28
|
+
export declare const chooseCoreSectionBySection: (section: string) => string;
|
|
28
29
|
export declare const chooseSectionCategoryByType: (secType: string) => SectionCategory | undefined;
|
|
29
30
|
export declare const chooseSectionCategory: (section: HTMLElement) => SectionCategory | undefined;
|
|
30
31
|
export declare const chooseSectionCategoryFromTitle: (title: string | null) => SectionCategory | undefined;
|
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": "1.5.
|
|
4
|
+
"version": "1.5.4-LEAN-3030",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "
|
|
32
|
+
"@manuscripts/json-schema": "2.2.1",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"jszip": "^3.10.1",
|
|
35
35
|
"mathjax-full": "^3.2.2",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAffiliationsSectionNode = exports.affiliationsSection = void 0;
|
|
4
|
-
exports.affiliationsSection = {
|
|
5
|
-
content: 'section_title? affiliation*',
|
|
6
|
-
attrs: {
|
|
7
|
-
id: { default: '' },
|
|
8
|
-
dataTracked: { default: null },
|
|
9
|
-
},
|
|
10
|
-
group: 'block sections',
|
|
11
|
-
selectable: false,
|
|
12
|
-
toDOM: () => ['section', 0],
|
|
13
|
-
};
|
|
14
|
-
const isAffiliationsSectionNode = (node) => node.type === node.type.schema.nodes.affiliations_section;
|
|
15
|
-
exports.isAffiliationsSectionNode = isAffiliationsSectionNode;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isContributorsSectionNode = exports.contributorsSection = void 0;
|
|
4
|
-
exports.contributorsSection = {
|
|
5
|
-
content: 'section_title? contributor*',
|
|
6
|
-
attrs: {
|
|
7
|
-
id: { default: '' },
|
|
8
|
-
dataTracked: { default: null },
|
|
9
|
-
},
|
|
10
|
-
group: 'block sections',
|
|
11
|
-
selectable: false,
|
|
12
|
-
toDOM: () => ['section', 0],
|
|
13
|
-
};
|
|
14
|
-
const isContributorsSectionNode = (node) => node.type === node.type.schema.nodes.contributors_section;
|
|
15
|
-
exports.isContributorsSectionNode = isContributorsSectionNode;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { ManuscriptNode } from '../types';
|
|
3
|
-
interface Attrs {
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AffiliationsSectionNode extends ManuscriptNode {
|
|
7
|
-
attrs: Attrs;
|
|
8
|
-
}
|
|
9
|
-
export declare const affiliationsSection: NodeSpec;
|
|
10
|
-
export declare const isAffiliationsSectionNode: (node: ManuscriptNode) => node is AffiliationsSectionNode;
|
|
11
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { ManuscriptNode } from '../types';
|
|
3
|
-
interface Attrs {
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ContributorsSectionNode extends ManuscriptNode {
|
|
7
|
-
attrs: Attrs;
|
|
8
|
-
}
|
|
9
|
-
export declare const contributorsSection: NodeSpec;
|
|
10
|
-
export declare const isContributorsSectionNode: (node: ManuscriptNode) => node is ContributorsSectionNode;
|
|
11
|
-
export {};
|