@manuscripts/transform 3.0.13-remove-toc.0 → 3.0.13
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/exporter/jats-exporter.js +2 -0
- package/dist/cjs/jats/importer/jats-dom-parser.js +5 -1
- package/dist/cjs/schema/index.js +6 -0
- package/dist/cjs/schema/migration/migration-scripts/index.js +1 -6
- package/dist/cjs/schema/nodes/toc_element.js +51 -0
- package/dist/cjs/schema/nodes/toc_section.js +46 -0
- package/dist/cjs/transformer/node-names.js +1 -0
- package/dist/cjs/transformer/node-title.js +1 -0
- package/dist/cjs/transformer/node-types.js +2 -0
- package/dist/cjs/transformer/section-category.js +5 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +2 -0
- package/dist/es/jats/importer/jats-dom-parser.js +5 -1
- package/dist/es/schema/index.js +6 -0
- package/dist/es/schema/migration/migration-scripts/index.js +1 -6
- package/dist/es/schema/nodes/toc_element.js +48 -0
- package/dist/es/schema/nodes/toc_section.js +42 -0
- package/dist/es/transformer/node-names.js +1 -0
- package/dist/es/transformer/node-title.js +1 -0
- package/dist/es/transformer/node-types.js +2 -0
- package/dist/es/transformer/section-category.js +5 -0
- package/dist/es/version.js +1 -1
- package/dist/types/schema/index.d.ts +2 -0
- package/dist/types/schema/migration/migration-scripts/index.d.ts +1 -2
- package/dist/types/schema/nodes/toc_element.d.ts +26 -0
- package/dist/types/schema/nodes/toc_section.d.ts +26 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/schema/migration/migration-scripts/3.0.12.js +0 -18
- package/dist/es/schema/migration/migration-scripts/3.0.12.js +0 -14
- package/dist/types/schema/migration/migration-scripts/3.0.12.d.ts +0 -7
|
@@ -811,6 +811,8 @@ class JATSExporter {
|
|
|
811
811
|
table_col: (node) => ['col', { width: node.attrs.width }],
|
|
812
812
|
table_colgroup: () => ['colgroup', 0],
|
|
813
813
|
text: (node) => node.text,
|
|
814
|
+
toc_element: () => '',
|
|
815
|
+
toc_section: () => '',
|
|
814
816
|
comment: () => '',
|
|
815
817
|
};
|
|
816
818
|
const marks = {
|
|
@@ -821,6 +821,10 @@ const nodes = [
|
|
|
821
821
|
node: 'bibliography_item',
|
|
822
822
|
getAttrs: (node) => parseRef(node),
|
|
823
823
|
},
|
|
824
|
+
{
|
|
825
|
+
tag: 'sec[sec-type="abstract-graphical"]',
|
|
826
|
+
node: 'graphical_abstract_section',
|
|
827
|
+
},
|
|
824
828
|
{
|
|
825
829
|
tag: 'sec',
|
|
826
830
|
node: 'section',
|
|
@@ -906,7 +910,7 @@ const nodes = [
|
|
|
906
910
|
{
|
|
907
911
|
tag: 'title',
|
|
908
912
|
node: 'section_title',
|
|
909
|
-
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/',
|
|
913
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/',
|
|
910
914
|
},
|
|
911
915
|
{
|
|
912
916
|
tag: 'title',
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -95,6 +95,8 @@ const table_element_1 = require("./nodes/table_element");
|
|
|
95
95
|
const table_element_footer_1 = require("./nodes/table_element_footer");
|
|
96
96
|
const text_1 = require("./nodes/text");
|
|
97
97
|
const title_1 = require("./nodes/title");
|
|
98
|
+
const toc_element_1 = require("./nodes/toc_element");
|
|
99
|
+
const toc_section_1 = require("./nodes/toc_section");
|
|
98
100
|
__exportStar(require("./groups"), exports);
|
|
99
101
|
__exportStar(require("./types"), exports);
|
|
100
102
|
__exportStar(require("./nodes/comment"), exports);
|
|
@@ -144,6 +146,8 @@ __exportStar(require("./nodes/table"), exports);
|
|
|
144
146
|
__exportStar(require("./nodes/table_col"), exports);
|
|
145
147
|
__exportStar(require("./nodes/table_element"), exports);
|
|
146
148
|
__exportStar(require("./nodes/text"), exports);
|
|
149
|
+
__exportStar(require("./nodes/toc_element"), exports);
|
|
150
|
+
__exportStar(require("./nodes/toc_section"), exports);
|
|
147
151
|
__exportStar(require("./nodes/affiliation"), exports);
|
|
148
152
|
__exportStar(require("./nodes/contributor"), exports);
|
|
149
153
|
__exportStar(require("./nodes/table_element_footer"), exports);
|
|
@@ -225,6 +229,8 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
225
229
|
table_colgroup: table_col_1.tableColGroup,
|
|
226
230
|
table_header: table_1.tableHeader,
|
|
227
231
|
text: text_1.text,
|
|
232
|
+
toc_element: toc_element_1.tocElement,
|
|
233
|
+
toc_section: toc_section_1.tocSection,
|
|
228
234
|
affiliation: affiliation_1.affiliation,
|
|
229
235
|
contributor: contributor_1.contributor,
|
|
230
236
|
table_element_footer: table_element_footer_1.tableElementFooter,
|
|
@@ -20,10 +20,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const _1_2_5_1 = __importDefault(require("./1.2.5"));
|
|
22
22
|
const _2_3_22_1 = __importDefault(require("./2.3.22"));
|
|
23
|
-
const
|
|
24
|
-
const migrations = [
|
|
25
|
-
new _1_2_5_1.default(),
|
|
26
|
-
new _2_3_22_1.default(),
|
|
27
|
-
new _3_0_12_1.Migration3012(),
|
|
28
|
-
];
|
|
23
|
+
const migrations = [new _1_2_5_1.default(), new _2_3_22_1.default()];
|
|
29
24
|
exports.default = migrations;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 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.tocElement = void 0;
|
|
19
|
+
const html_1 = require("../../lib/html");
|
|
20
|
+
const createBodyElement = (node) => {
|
|
21
|
+
const dom = document.createElement('div');
|
|
22
|
+
dom.classList.add('manuscript-toc');
|
|
23
|
+
dom.id = node.attrs.id;
|
|
24
|
+
return dom;
|
|
25
|
+
};
|
|
26
|
+
exports.tocElement = {
|
|
27
|
+
atom: true,
|
|
28
|
+
attrs: {
|
|
29
|
+
id: { default: '' },
|
|
30
|
+
contents: { default: '' },
|
|
31
|
+
dataTracked: { default: null },
|
|
32
|
+
},
|
|
33
|
+
group: 'block element',
|
|
34
|
+
selectable: false,
|
|
35
|
+
parseDOM: [
|
|
36
|
+
{
|
|
37
|
+
tag: 'div.manuscript-toc',
|
|
38
|
+
getAttrs: (p) => {
|
|
39
|
+
const dom = p;
|
|
40
|
+
return {
|
|
41
|
+
contents: dom.innerHTML,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
toDOM: (node) => {
|
|
47
|
+
const tocElementNode = node;
|
|
48
|
+
return ((0, html_1.nodeFromHTML)(tocElementNode.attrs.contents) ||
|
|
49
|
+
createBodyElement(tocElementNode));
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 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.isTOCSectionNode = exports.tocSection = void 0;
|
|
19
|
+
exports.tocSection = {
|
|
20
|
+
content: 'section_title (toc_element | placeholder_element)',
|
|
21
|
+
attrs: {
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
group: 'block sections',
|
|
26
|
+
selectable: false,
|
|
27
|
+
parseDOM: [
|
|
28
|
+
{
|
|
29
|
+
tag: 'section.toc',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
toDOM: (node) => {
|
|
33
|
+
const tocSectioNode = node;
|
|
34
|
+
return [
|
|
35
|
+
'section',
|
|
36
|
+
{
|
|
37
|
+
id: tocSectioNode.attrs.id,
|
|
38
|
+
class: 'toc',
|
|
39
|
+
spellcheck: 'false',
|
|
40
|
+
},
|
|
41
|
+
0,
|
|
42
|
+
];
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const isTOCSectionNode = (node) => node.type === node.type.schema.nodes.toc_section;
|
|
46
|
+
exports.isTOCSectionNode = isTOCSectionNode;
|
|
@@ -54,5 +54,6 @@ exports.nodeNames = new Map([
|
|
|
54
54
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
55
55
|
[schema_1.schema.nodes.blockquote_element, 'Block Quote'],
|
|
56
56
|
[schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
|
|
57
|
+
[schema_1.schema.nodes.toc_section, 'Section'],
|
|
57
58
|
[schema_1.schema.nodes.box_element, 'Box'],
|
|
58
59
|
]);
|
|
@@ -51,6 +51,7 @@ const nodeTitle = (node) => {
|
|
|
51
51
|
case nodes.bibliography_section:
|
|
52
52
|
case nodes.footnotes_section:
|
|
53
53
|
case nodes.keywords:
|
|
54
|
+
case nodes.toc_section:
|
|
54
55
|
case nodes.graphical_abstract_section:
|
|
55
56
|
return snippetOfNodeType(node, nodes.section_title);
|
|
56
57
|
case nodes.footnotes_element:
|
|
@@ -51,6 +51,8 @@ exports.nodeTypesMap = new Map([
|
|
|
51
51
|
[schema_1.schema.nodes.section, json_schema_1.ObjectTypes.Section],
|
|
52
52
|
[schema_1.schema.nodes.table, json_schema_1.ObjectTypes.Table],
|
|
53
53
|
[schema_1.schema.nodes.table_element, json_schema_1.ObjectTypes.TableElement],
|
|
54
|
+
[schema_1.schema.nodes.toc_element, json_schema_1.ObjectTypes.TOCElement],
|
|
55
|
+
[schema_1.schema.nodes.toc_section, json_schema_1.ObjectTypes.Section],
|
|
54
56
|
[schema_1.schema.nodes.affiliation, json_schema_1.ObjectTypes.Affiliation],
|
|
55
57
|
[schema_1.schema.nodes.contributor, json_schema_1.ObjectTypes.Contributor],
|
|
56
58
|
[schema_1.schema.nodes.table_element_footer, json_schema_1.ObjectTypes.TableElementFooter],
|
|
@@ -24,6 +24,7 @@ const sectionNodeTypes = [
|
|
|
24
24
|
schema_1.schema.nodes.footnotes_section,
|
|
25
25
|
schema_1.schema.nodes.keywords,
|
|
26
26
|
schema_1.schema.nodes.section,
|
|
27
|
+
schema_1.schema.nodes.toc_section,
|
|
27
28
|
];
|
|
28
29
|
const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
29
30
|
exports.isAnySectionNode = isAnySectionNode;
|
|
@@ -37,6 +38,8 @@ const chooseSectionNodeType = (category) => {
|
|
|
37
38
|
return schema_1.schema.nodes.footnotes_section;
|
|
38
39
|
case 'MPSectionCategory:keywords':
|
|
39
40
|
return schema_1.schema.nodes.keywords;
|
|
41
|
+
case 'MPSectionCategory:toc':
|
|
42
|
+
return schema_1.schema.nodes.toc_section;
|
|
40
43
|
case 'MPSectionCategory:box-element':
|
|
41
44
|
return schema_1.schema.nodes.box_element;
|
|
42
45
|
default:
|
|
@@ -79,6 +82,8 @@ const buildSectionCategory = (node) => {
|
|
|
79
82
|
return 'MPSectionCategory:endnotes';
|
|
80
83
|
case schema_1.schema.nodes.keywords:
|
|
81
84
|
return 'MPSectionCategory:keywords';
|
|
85
|
+
case schema_1.schema.nodes.toc_section:
|
|
86
|
+
return 'MPSectionCategory:toc';
|
|
82
87
|
case schema_1.schema.nodes.graphical_abstract_section:
|
|
83
88
|
return 'MPSectionCategory:abstract-graphical';
|
|
84
89
|
case schema_1.schema.nodes.box_element:
|
package/dist/cjs/version.js
CHANGED
|
@@ -803,6 +803,8 @@ export class JATSExporter {
|
|
|
803
803
|
table_col: (node) => ['col', { width: node.attrs.width }],
|
|
804
804
|
table_colgroup: () => ['colgroup', 0],
|
|
805
805
|
text: (node) => node.text,
|
|
806
|
+
toc_element: () => '',
|
|
807
|
+
toc_section: () => '',
|
|
806
808
|
comment: () => '',
|
|
807
809
|
};
|
|
808
810
|
const marks = {
|
|
@@ -815,6 +815,10 @@ const nodes = [
|
|
|
815
815
|
node: 'bibliography_item',
|
|
816
816
|
getAttrs: (node) => parseRef(node),
|
|
817
817
|
},
|
|
818
|
+
{
|
|
819
|
+
tag: 'sec[sec-type="abstract-graphical"]',
|
|
820
|
+
node: 'graphical_abstract_section',
|
|
821
|
+
},
|
|
818
822
|
{
|
|
819
823
|
tag: 'sec',
|
|
820
824
|
node: 'section',
|
|
@@ -900,7 +904,7 @@ const nodes = [
|
|
|
900
904
|
{
|
|
901
905
|
tag: 'title',
|
|
902
906
|
node: 'section_title',
|
|
903
|
-
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/',
|
|
907
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/',
|
|
904
908
|
},
|
|
905
909
|
{
|
|
906
910
|
tag: 'title',
|
package/dist/es/schema/index.js
CHANGED
|
@@ -78,6 +78,8 @@ import { tableElement } from './nodes/table_element';
|
|
|
78
78
|
import { tableElementFooter } from './nodes/table_element_footer';
|
|
79
79
|
import { text } from './nodes/text';
|
|
80
80
|
import { title } from './nodes/title';
|
|
81
|
+
import { tocElement } from './nodes/toc_element';
|
|
82
|
+
import { tocSection } from './nodes/toc_section';
|
|
81
83
|
export * from './groups';
|
|
82
84
|
export * from './types';
|
|
83
85
|
export * from './nodes/comment';
|
|
@@ -127,6 +129,8 @@ export * from './nodes/table';
|
|
|
127
129
|
export * from './nodes/table_col';
|
|
128
130
|
export * from './nodes/table_element';
|
|
129
131
|
export * from './nodes/text';
|
|
132
|
+
export * from './nodes/toc_element';
|
|
133
|
+
export * from './nodes/toc_section';
|
|
130
134
|
export * from './nodes/affiliation';
|
|
131
135
|
export * from './nodes/contributor';
|
|
132
136
|
export * from './nodes/table_element_footer';
|
|
@@ -208,6 +212,8 @@ export const schema = new Schema({
|
|
|
208
212
|
table_colgroup: tableColGroup,
|
|
209
213
|
table_header: tableHeader,
|
|
210
214
|
text,
|
|
215
|
+
toc_element: tocElement,
|
|
216
|
+
toc_section: tocSection,
|
|
211
217
|
affiliation,
|
|
212
218
|
contributor: contributor,
|
|
213
219
|
table_element_footer: tableElementFooter,
|
|
@@ -15,10 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import Migration125 from './1.2.5';
|
|
17
17
|
import Migration2322 from './2.3.22';
|
|
18
|
-
|
|
19
|
-
const migrations = [
|
|
20
|
-
new Migration125(),
|
|
21
|
-
new Migration2322(),
|
|
22
|
-
new Migration3012(),
|
|
23
|
-
];
|
|
18
|
+
const migrations = [new Migration125(), new Migration2322()];
|
|
24
19
|
export default migrations;
|
|
@@ -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 { nodeFromHTML } from '../../lib/html';
|
|
17
|
+
const createBodyElement = (node) => {
|
|
18
|
+
const dom = document.createElement('div');
|
|
19
|
+
dom.classList.add('manuscript-toc');
|
|
20
|
+
dom.id = node.attrs.id;
|
|
21
|
+
return dom;
|
|
22
|
+
};
|
|
23
|
+
export const tocElement = {
|
|
24
|
+
atom: true,
|
|
25
|
+
attrs: {
|
|
26
|
+
id: { default: '' },
|
|
27
|
+
contents: { default: '' },
|
|
28
|
+
dataTracked: { default: null },
|
|
29
|
+
},
|
|
30
|
+
group: 'block element',
|
|
31
|
+
selectable: false,
|
|
32
|
+
parseDOM: [
|
|
33
|
+
{
|
|
34
|
+
tag: 'div.manuscript-toc',
|
|
35
|
+
getAttrs: (p) => {
|
|
36
|
+
const dom = p;
|
|
37
|
+
return {
|
|
38
|
+
contents: dom.innerHTML,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
toDOM: (node) => {
|
|
44
|
+
const tocElementNode = node;
|
|
45
|
+
return (nodeFromHTML(tocElementNode.attrs.contents) ||
|
|
46
|
+
createBodyElement(tocElementNode));
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const tocSection = {
|
|
17
|
+
content: 'section_title (toc_element | placeholder_element)',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block sections',
|
|
23
|
+
selectable: false,
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'section.toc',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const tocSectioNode = node;
|
|
31
|
+
return [
|
|
32
|
+
'section',
|
|
33
|
+
{
|
|
34
|
+
id: tocSectioNode.attrs.id,
|
|
35
|
+
class: 'toc',
|
|
36
|
+
spellcheck: 'false',
|
|
37
|
+
},
|
|
38
|
+
0,
|
|
39
|
+
];
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const isTOCSectionNode = (node) => node.type === node.type.schema.nodes.toc_section;
|
|
@@ -51,5 +51,6 @@ export const nodeNames = new Map([
|
|
|
51
51
|
[schema.nodes.table_element, 'Table'],
|
|
52
52
|
[schema.nodes.blockquote_element, 'Block Quote'],
|
|
53
53
|
[schema.nodes.pullquote_element, 'Pull Quote'],
|
|
54
|
+
[schema.nodes.toc_section, 'Section'],
|
|
54
55
|
[schema.nodes.box_element, 'Box'],
|
|
55
56
|
]);
|
|
@@ -48,6 +48,7 @@ export const nodeTitle = (node) => {
|
|
|
48
48
|
case nodes.bibliography_section:
|
|
49
49
|
case nodes.footnotes_section:
|
|
50
50
|
case nodes.keywords:
|
|
51
|
+
case nodes.toc_section:
|
|
51
52
|
case nodes.graphical_abstract_section:
|
|
52
53
|
return snippetOfNodeType(node, nodes.section_title);
|
|
53
54
|
case nodes.footnotes_element:
|
|
@@ -48,6 +48,8 @@ export const nodeTypesMap = new Map([
|
|
|
48
48
|
[schema.nodes.section, ObjectTypes.Section],
|
|
49
49
|
[schema.nodes.table, ObjectTypes.Table],
|
|
50
50
|
[schema.nodes.table_element, ObjectTypes.TableElement],
|
|
51
|
+
[schema.nodes.toc_element, ObjectTypes.TOCElement],
|
|
52
|
+
[schema.nodes.toc_section, ObjectTypes.Section],
|
|
51
53
|
[schema.nodes.affiliation, ObjectTypes.Affiliation],
|
|
52
54
|
[schema.nodes.contributor, ObjectTypes.Contributor],
|
|
53
55
|
[schema.nodes.table_element_footer, ObjectTypes.TableElementFooter],
|
|
@@ -21,6 +21,7 @@ const sectionNodeTypes = [
|
|
|
21
21
|
schema.nodes.footnotes_section,
|
|
22
22
|
schema.nodes.keywords,
|
|
23
23
|
schema.nodes.section,
|
|
24
|
+
schema.nodes.toc_section,
|
|
24
25
|
];
|
|
25
26
|
export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
26
27
|
export const chooseSectionNodeType = (category) => {
|
|
@@ -33,6 +34,8 @@ export const chooseSectionNodeType = (category) => {
|
|
|
33
34
|
return schema.nodes.footnotes_section;
|
|
34
35
|
case 'MPSectionCategory:keywords':
|
|
35
36
|
return schema.nodes.keywords;
|
|
37
|
+
case 'MPSectionCategory:toc':
|
|
38
|
+
return schema.nodes.toc_section;
|
|
36
39
|
case 'MPSectionCategory:box-element':
|
|
37
40
|
return schema.nodes.box_element;
|
|
38
41
|
default:
|
|
@@ -72,6 +75,8 @@ export const buildSectionCategory = (node) => {
|
|
|
72
75
|
return 'MPSectionCategory:endnotes';
|
|
73
76
|
case schema.nodes.keywords:
|
|
74
77
|
return 'MPSectionCategory:keywords';
|
|
78
|
+
case schema.nodes.toc_section:
|
|
79
|
+
return 'MPSectionCategory:toc';
|
|
75
80
|
case schema.nodes.graphical_abstract_section:
|
|
76
81
|
return 'MPSectionCategory:abstract-graphical';
|
|
77
82
|
case schema.nodes.box_element:
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.13
|
|
1
|
+
export const VERSION = "3.0.13";
|
|
@@ -64,6 +64,8 @@ export * from './nodes/table';
|
|
|
64
64
|
export * from './nodes/table_col';
|
|
65
65
|
export * from './nodes/table_element';
|
|
66
66
|
export * from './nodes/text';
|
|
67
|
+
export * from './nodes/toc_element';
|
|
68
|
+
export * from './nodes/toc_section';
|
|
67
69
|
export * from './nodes/affiliation';
|
|
68
70
|
export * from './nodes/contributor';
|
|
69
71
|
export * from './nodes/table_element_footer';
|
|
@@ -15,6 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import Migration125 from './1.2.5';
|
|
17
17
|
import Migration2322 from './2.3.22';
|
|
18
|
-
|
|
19
|
-
declare const migrations: (Migration125 | Migration2322 | Migration3012)[];
|
|
18
|
+
declare const migrations: (Migration125 | Migration2322)[];
|
|
20
19
|
export default migrations;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
contents: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TOCElementNode extends ManuscriptNode {
|
|
23
|
+
attrs: Attrs;
|
|
24
|
+
}
|
|
25
|
+
export declare const tocElement: NodeSpec;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
21
|
+
export interface TOCSectionNode extends ManuscriptNode {
|
|
22
|
+
attrs: Attrs;
|
|
23
|
+
}
|
|
24
|
+
export declare const tocSection: NodeSpec;
|
|
25
|
+
export declare const isTOCSectionNode: (node: ManuscriptNode) => node is TOCSectionNode;
|
|
26
|
+
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' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.13
|
|
1
|
+
export declare const VERSION = "3.0.13";
|
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": "3.0.13
|
|
4
|
+
"version": "3.0.13",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Migration3012 = void 0;
|
|
4
|
-
class Migration3012 {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.fromVersion = '3.0.12';
|
|
7
|
-
this.toVersion = '3.0.13';
|
|
8
|
-
}
|
|
9
|
-
migrateNode(node) {
|
|
10
|
-
var _a;
|
|
11
|
-
if (node.type === 'body') {
|
|
12
|
-
const content = (_a = node.content) === null || _a === void 0 ? void 0 : _a.filter((n) => n.type !== 'toc_section');
|
|
13
|
-
return Object.assign(Object.assign({}, node), { content });
|
|
14
|
-
}
|
|
15
|
-
return node;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.Migration3012 = Migration3012;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class Migration3012 {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.fromVersion = '3.0.12';
|
|
4
|
-
this.toVersion = '3.0.13';
|
|
5
|
-
}
|
|
6
|
-
migrateNode(node) {
|
|
7
|
-
var _a;
|
|
8
|
-
if (node.type === 'body') {
|
|
9
|
-
const content = (_a = node.content) === null || _a === void 0 ? void 0 : _a.filter((n) => n.type !== 'toc_section');
|
|
10
|
-
return Object.assign(Object.assign({}, node), { content });
|
|
11
|
-
}
|
|
12
|
-
return node;
|
|
13
|
-
}
|
|
14
|
-
}
|