@manuscripts/transform 1.5.1-LEAN-2852-9 → 1.5.2
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/parse-jats-article.js +2 -11
- package/dist/cjs/jats/jats-exporter.js +6 -8
- package/dist/cjs/schema/index.js +0 -3
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/transformer/builders.js +3 -8
- package/dist/cjs/transformer/decode.js +1 -20
- package/dist/cjs/transformer/encode.js +0 -6
- package/dist/cjs/transformer/html.js +5 -6
- package/dist/cjs/transformer/labels.js +8 -4
- package/dist/cjs/transformer/node-title.js +4 -6
- package/dist/cjs/transformer/node-types.js +0 -1
- package/dist/cjs/transformer/project-bundle.js +1 -22
- package/dist/es/jats/importer/parse-jats-article.js +2 -11
- package/dist/es/jats/jats-exporter.js +7 -9
- package/dist/es/schema/index.js +0 -3
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/transformer/builders.js +2 -6
- package/dist/es/transformer/decode.js +1 -20
- package/dist/es/transformer/encode.js +0 -6
- package/dist/es/transformer/html.js +6 -7
- package/dist/es/transformer/labels.js +8 -4
- package/dist/es/transformer/node-title.js +5 -7
- package/dist/es/transformer/node-types.js +0 -1
- package/dist/es/transformer/project-bundle.js +0 -20
- package/dist/types/schema/index.d.ts +0 -1
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +2 -3
- package/dist/types/transformer/decode.d.ts +0 -1
- package/dist/types/transformer/project-bundle.d.ts +1 -2
- package/package.json +2 -2
- package/dist/cjs/schema/nodes/title.js +0 -29
- package/dist/es/schema/nodes/title.js +0 -26
- package/dist/types/schema/nodes/title.d.ts +0 -28
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.getElementsOrder = exports.parseJATSArticle = exports.parseJATSBody = exports.parseJATSReferences = exports.parseJATSFront = void 0;
|
|
19
|
-
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
19
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
21
20
|
const errors_1 = require("../../errors");
|
|
22
21
|
const html_1 = require("../../lib/html");
|
|
@@ -52,16 +51,9 @@ const parseJATSFront = async (front) => {
|
|
|
52
51
|
const title = (_a = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > article-title')) === null || _a === void 0 ? void 0 : _a.innerHTML;
|
|
53
52
|
const subtitle = (_b = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > subtitle')) === null || _b === void 0 ? void 0 : _b.innerHTML;
|
|
54
53
|
const runningTitle = (_c = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > alt-title[alt-title-type="right-running"]')) === null || _c === void 0 ? void 0 : _c.innerHTML;
|
|
55
|
-
const manuscriptMeta = Object.assign({
|
|
56
|
-
const titles = {
|
|
57
|
-
objectType: json_schema_1.ObjectTypes.Titles,
|
|
58
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Titles),
|
|
59
|
-
title: title ? inlineContentsFromJATSTitle(title) : undefined,
|
|
60
|
-
subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined,
|
|
61
|
-
runningTitle: runningTitle
|
|
54
|
+
const manuscriptMeta = Object.assign({ title: title ? inlineContentsFromJATSTitle(title) : undefined, subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined, runningTitle: runningTitle
|
|
62
55
|
? inlineContentsFromJATSTitle(runningTitle)
|
|
63
|
-
: undefined,
|
|
64
|
-
};
|
|
56
|
+
: undefined }, jats_front_parser_1.jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
|
|
65
57
|
const { affiliations, affiliationIDs } = jats_front_parser_1.jatsFrontParser.parseAffiliationNodes([
|
|
66
58
|
...front.querySelectorAll('article-meta > contrib-group > aff'),
|
|
67
59
|
]);
|
|
@@ -81,7 +73,6 @@ const parseJATSFront = async (front) => {
|
|
|
81
73
|
const manuscript = Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), manuscriptMeta), history);
|
|
82
74
|
return {
|
|
83
75
|
models: generateModelIDs([
|
|
84
|
-
titles,
|
|
85
76
|
manuscript,
|
|
86
77
|
...footnotes,
|
|
87
78
|
...correspondingList,
|
|
@@ -238,7 +238,6 @@ class JATSExporter {
|
|
|
238
238
|
this.buildFront = (doi, id, links) => {
|
|
239
239
|
var _a, _b, _c, _d;
|
|
240
240
|
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
241
|
-
const titles = (0, project_bundle_1.findTitles)(this.modelMap);
|
|
242
241
|
const front = this.document.createElement('front');
|
|
243
242
|
const journalMeta = this.document.createElement('journal-meta');
|
|
244
243
|
front.appendChild(journalMeta);
|
|
@@ -316,20 +315,20 @@ class JATSExporter {
|
|
|
316
315
|
articleMeta.appendChild(link);
|
|
317
316
|
}
|
|
318
317
|
}
|
|
319
|
-
if (
|
|
318
|
+
if (manuscript.title) {
|
|
320
319
|
const element = this.document.createElement('article-title');
|
|
321
|
-
this.setTitleContent(element,
|
|
320
|
+
this.setTitleContent(element, manuscript.title);
|
|
322
321
|
titleGroup.appendChild(element);
|
|
323
322
|
}
|
|
324
|
-
if (
|
|
323
|
+
if (manuscript.subtitle) {
|
|
325
324
|
const element = this.document.createElement('subtitle');
|
|
326
|
-
this.setTitleContent(element,
|
|
325
|
+
this.setTitleContent(element, manuscript.subtitle);
|
|
327
326
|
titleGroup.appendChild(element);
|
|
328
327
|
}
|
|
329
|
-
if (
|
|
328
|
+
if (manuscript.runningTitle) {
|
|
330
329
|
const element = this.document.createElement('alt-title');
|
|
331
330
|
element.setAttribute('alt-title-type', 'right-running');
|
|
332
|
-
this.setTitleContent(element,
|
|
331
|
+
this.setTitleContent(element, manuscript.runningTitle);
|
|
333
332
|
titleGroup.appendChild(element);
|
|
334
333
|
}
|
|
335
334
|
const supplements = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Supplement);
|
|
@@ -599,7 +598,6 @@ class JATSExporter {
|
|
|
599
598
|
this.createSerializer = () => {
|
|
600
599
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
601
600
|
const nodes = {
|
|
602
|
-
title: () => '',
|
|
603
601
|
affiliations_section: () => '',
|
|
604
602
|
contributors_section: () => '',
|
|
605
603
|
table_element_footer: () => ['table-wrap-foot', 0],
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -85,7 +85,6 @@ const table_element_1 = require("./nodes/table_element");
|
|
|
85
85
|
const table_element_footer_1 = require("./nodes/table_element_footer");
|
|
86
86
|
const table_row_1 = require("./nodes/table_row");
|
|
87
87
|
const text_1 = require("./nodes/text");
|
|
88
|
-
const title_1 = require("./nodes/title");
|
|
89
88
|
const toc_element_1 = require("./nodes/toc_element");
|
|
90
89
|
const toc_section_1 = require("./nodes/toc_section");
|
|
91
90
|
__exportStar(require("./groups"), exports);
|
|
@@ -141,7 +140,6 @@ __exportStar(require("./nodes/affiliation"), exports);
|
|
|
141
140
|
__exportStar(require("./nodes/meta_section"), exports);
|
|
142
141
|
__exportStar(require("./nodes/contributor"), exports);
|
|
143
142
|
__exportStar(require("./nodes/table_element_footer"), exports);
|
|
144
|
-
__exportStar(require("./nodes/title"), exports);
|
|
145
143
|
__exportStar(require("./nodes/affiliations_section"), exports);
|
|
146
144
|
__exportStar(require("./nodes/contributors_section"), exports);
|
|
147
145
|
exports.schema = new prosemirror_model_1.Schema({
|
|
@@ -218,7 +216,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
218
216
|
meta_section: meta_section_1.metaSection,
|
|
219
217
|
contributor: contributor_1.contributor,
|
|
220
218
|
table_element_footer: table_element_footer_1.tableElementFooter,
|
|
221
|
-
title: title_1.title,
|
|
222
219
|
affiliations_section: affiliations_section_1.affiliationsSection,
|
|
223
220
|
contributors_section: contributors_section_1.contributorsSection,
|
|
224
221
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: '
|
|
20
|
+
content: '(section | sections)+ meta_section',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
},
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildStatusLabel = exports.buildJournal = exports.buildAttribution = exports.buildInlineStyle = exports.buildContributorRole = exports.buildContribution = exports.buildHighlightMarker = exports.buildHighlight = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildValidation = exports.buildNote = exports.buildComment = exports.buildUserProfileAffiliation = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildLibraryCollection = exports.buildManuscriptKeyword = exports.buildKeywordGroup = exports.buildKeyword = exports.buildCitation = exports.buildEmbeddedCitationItem = exports.buildAuxiliaryObjectReference = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = exports.DEFAULT_PAGE_LAYOUT = exports.DEFAULT_BUNDLE = void 0;
|
|
22
22
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
23
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
24
24
|
const schema_1 = require("../schema");
|
|
@@ -35,9 +35,10 @@ const buildProject = (owner) => ({
|
|
|
35
35
|
title: '',
|
|
36
36
|
});
|
|
37
37
|
exports.buildProject = buildProject;
|
|
38
|
-
const buildManuscript = () => ({
|
|
38
|
+
const buildManuscript = (title = '') => ({
|
|
39
39
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Manuscript),
|
|
40
40
|
objectType: json_schema_1.ObjectTypes.Manuscript,
|
|
41
|
+
title,
|
|
41
42
|
});
|
|
42
43
|
exports.buildManuscript = buildManuscript;
|
|
43
44
|
const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
|
|
@@ -290,9 +291,3 @@ const buildElementsOrder = (elementType) => ({
|
|
|
290
291
|
elements: [],
|
|
291
292
|
});
|
|
292
293
|
exports.buildElementsOrder = buildElementsOrder;
|
|
293
|
-
const buildTitles = (title) => ({
|
|
294
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Titles),
|
|
295
|
-
objectType: json_schema_1.ObjectTypes.Titles,
|
|
296
|
-
title: title || '',
|
|
297
|
-
});
|
|
298
|
-
exports.buildTitles = buildTitles;
|
|
@@ -35,7 +35,6 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
35
35
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
36
36
|
const errors_1 = require("../errors");
|
|
37
37
|
const schema_1 = require("../schema");
|
|
38
|
-
const builders_1 = require("./builders");
|
|
39
38
|
const highlight_markers_1 = require("./highlight-markers");
|
|
40
39
|
const id_1 = require("./id");
|
|
41
40
|
const object_types_1 = require("./object-types");
|
|
@@ -116,11 +115,6 @@ class Decoder {
|
|
|
116
115
|
rootSectionNodes.unshift(node);
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
createTitleNode() {
|
|
120
|
-
const titles = (0, exports.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.Titles)[0] ||
|
|
121
|
-
(0, builders_1.buildTitles)();
|
|
122
|
-
return this.decode(titles);
|
|
123
|
-
}
|
|
124
118
|
createRootSectionNodes() {
|
|
125
119
|
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
126
120
|
rootSections = this.addGeneratedLabels(rootSections);
|
|
@@ -153,14 +147,6 @@ class Decoder {
|
|
|
153
147
|
constructor(modelMap, allowMissingElements = false) {
|
|
154
148
|
this.comments = new Map();
|
|
155
149
|
this.creators = {
|
|
156
|
-
[json_schema_1.ObjectTypes.Titles]: (data) => {
|
|
157
|
-
const model = data;
|
|
158
|
-
return this.parseContents(model.title, 'div', undefined, {
|
|
159
|
-
topNode: schema_1.schema.nodes.title.create({
|
|
160
|
-
id: model._id,
|
|
161
|
-
}),
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
150
|
[json_schema_1.ObjectTypes.BibliographyElement]: (data) => {
|
|
165
151
|
var _a;
|
|
166
152
|
const model = data;
|
|
@@ -645,14 +631,9 @@ class Decoder {
|
|
|
645
631
|
};
|
|
646
632
|
this.getModel = (id) => this.modelMap.get(id);
|
|
647
633
|
this.createArticleNode = (manuscriptID) => {
|
|
648
|
-
const titlesNode = this.createTitleNode();
|
|
649
634
|
const rootSectionNodes = this.createRootSectionNodes();
|
|
650
635
|
const metaSectionNode = this.createMetaSectionNode();
|
|
651
|
-
const contents = [
|
|
652
|
-
titlesNode,
|
|
653
|
-
...rootSectionNodes,
|
|
654
|
-
metaSectionNode,
|
|
655
|
-
];
|
|
636
|
+
const contents = [...rootSectionNodes, metaSectionNode];
|
|
656
637
|
return schema_1.schema.nodes.manuscript.create({
|
|
657
638
|
id: manuscriptID || this.getManuscriptID(),
|
|
658
639
|
}, contents);
|
|
@@ -263,12 +263,6 @@ function figureElementEncoder(node) {
|
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
const encoders = {
|
|
266
|
-
title: (node) => ({
|
|
267
|
-
title: node.attrs.title,
|
|
268
|
-
subtitle: node.attrs.subtitle,
|
|
269
|
-
runningTitle: node.attrs.runningTitle,
|
|
270
|
-
_id: node.attrs._id,
|
|
271
|
-
}),
|
|
272
266
|
bibliography_element: (node) => ({
|
|
273
267
|
elementType: 'div',
|
|
274
268
|
contents: '',
|
|
@@ -152,7 +152,6 @@ class HTMLTransformer {
|
|
|
152
152
|
this.buildFront = () => {
|
|
153
153
|
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
154
154
|
const journal = (0, project_bundle_1.findJournal)(this.modelMap);
|
|
155
|
-
const titles = (0, project_bundle_1.findTitles)(this.modelMap);
|
|
156
155
|
if (!manuscript) {
|
|
157
156
|
throw new Error('Manuscript not found in project modelMap');
|
|
158
157
|
}
|
|
@@ -171,14 +170,14 @@ class HTMLTransformer {
|
|
|
171
170
|
}
|
|
172
171
|
const articleMeta = this.document.createElement('div');
|
|
173
172
|
front.appendChild(articleMeta);
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
|
|
173
|
+
const articleTitle = this.document.createElement('h1');
|
|
174
|
+
if (manuscript.title) {
|
|
175
|
+
articleTitle.innerHTML = manuscript.title;
|
|
177
176
|
}
|
|
178
177
|
if (journal === null || journal === void 0 ? void 0 : journal.title) {
|
|
179
|
-
|
|
178
|
+
articleTitle.setAttribute('data-journal', journal.title);
|
|
180
179
|
}
|
|
181
|
-
articleMeta.appendChild(
|
|
180
|
+
articleMeta.appendChild(articleTitle);
|
|
182
181
|
if (manuscript.DOI) {
|
|
183
182
|
const articleID = this.document.createElement('article-id');
|
|
184
183
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
@@ -56,10 +56,14 @@ const buildTargets = (fragment, manuscript) => {
|
|
|
56
56
|
const targets = new Map();
|
|
57
57
|
const figures = [];
|
|
58
58
|
fragment.forEach((node) => {
|
|
59
|
-
if (node.
|
|
60
|
-
node.forEach((
|
|
61
|
-
if (
|
|
62
|
-
|
|
59
|
+
if (node.attrs.category === 'MPSectionCategory:abstracts') {
|
|
60
|
+
node.forEach((child) => {
|
|
61
|
+
if (child.type === node.type.schema.nodes.graphical_abstract_section) {
|
|
62
|
+
child.forEach((item) => {
|
|
63
|
+
if (item.type === node.type.schema.nodes.figure_element) {
|
|
64
|
+
figures.push(item.attrs.id);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
69
|
}
|
|
@@ -32,7 +32,7 @@ const textSnippet = (node, max = 100) => {
|
|
|
32
32
|
text += ' ';
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
return text.
|
|
35
|
+
return text.substr(0, max);
|
|
36
36
|
};
|
|
37
37
|
const snippetOfNodeType = (node, nodeType) => {
|
|
38
38
|
for (const child of (0, utils_1.iterateChildren)(node, true)) {
|
|
@@ -43,10 +43,8 @@ const snippetOfNodeType = (node, nodeType) => {
|
|
|
43
43
|
return null;
|
|
44
44
|
};
|
|
45
45
|
const nodeTitle = (node) => {
|
|
46
|
-
const nodes =
|
|
46
|
+
const nodes = node.type.schema.nodes;
|
|
47
47
|
switch (node.type) {
|
|
48
|
-
case nodes.manuscript:
|
|
49
|
-
return snippetOfNodeType(node, nodes.title);
|
|
50
48
|
case nodes.section:
|
|
51
49
|
case nodes.bibliography_section:
|
|
52
50
|
case nodes.footnotes_section:
|
|
@@ -74,9 +72,9 @@ const nodeTitle = (node) => {
|
|
|
74
72
|
};
|
|
75
73
|
exports.nodeTitle = nodeTitle;
|
|
76
74
|
const nodeTitlePlaceholder = (nodeType) => {
|
|
77
|
-
const nodes =
|
|
75
|
+
const nodes = nodeType.schema.nodes;
|
|
78
76
|
switch (nodeType) {
|
|
79
|
-
case nodes.
|
|
77
|
+
case nodes.title:
|
|
80
78
|
return 'Untitled Manuscript';
|
|
81
79
|
case nodes.section:
|
|
82
80
|
return 'Untitled Section';
|
|
@@ -57,7 +57,6 @@ exports.nodeTypesMap = new Map([
|
|
|
57
57
|
[schema_1.schema.nodes.affiliation, json_schema_1.ObjectTypes.Affiliation],
|
|
58
58
|
[schema_1.schema.nodes.contributor, json_schema_1.ObjectTypes.Contributor],
|
|
59
59
|
[schema_1.schema.nodes.table_element_footer, json_schema_1.ObjectTypes.TableElementFooter],
|
|
60
|
-
[schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
|
|
61
60
|
[schema_1.schema.nodes.contributors_section, json_schema_1.ObjectTypes.Section],
|
|
62
61
|
[schema_1.schema.nodes.affiliations_section, json_schema_1.ObjectTypes.Section],
|
|
63
62
|
]);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.findManuscriptById = exports.findManuscriptModelByType = exports.findJournal = exports.findManuscript = exports.parseProjectBundle = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const decode_1 = require("./decode");
|
|
21
21
|
const object_types_1 = require("./object-types");
|
|
@@ -71,24 +71,3 @@ const findManuscriptById = (modelMap, manuscriptID) => {
|
|
|
71
71
|
throw new Error(`There is no manuscript found for the following _id (${manuscriptID})`);
|
|
72
72
|
};
|
|
73
73
|
exports.findManuscriptById = findManuscriptById;
|
|
74
|
-
const isTitle = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Titles);
|
|
75
|
-
const findTitles = (modelMap) => {
|
|
76
|
-
for (const model of modelMap.values()) {
|
|
77
|
-
if (isTitle(model)) {
|
|
78
|
-
return model;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const defaultTitle = {
|
|
82
|
-
_id: 'MPTitles:8EB79C14-9F61-483A-902F-A0B8EF5973C1',
|
|
83
|
-
createdAt: 1538472121.690101,
|
|
84
|
-
updatedAt: 1538472121.690101,
|
|
85
|
-
objectType: 'MPTitles',
|
|
86
|
-
title: 'main title',
|
|
87
|
-
subtitle: 'subtitle',
|
|
88
|
-
runningTitle: 'running title',
|
|
89
|
-
manuscriptID: 'MPManuscript:E3830344-E77B-42BA-BD77-3E95489712A0',
|
|
90
|
-
containerID: 'MPProject:1',
|
|
91
|
-
};
|
|
92
|
-
return defaultTitle;
|
|
93
|
-
};
|
|
94
|
-
exports.findTitles = findTitles;
|
|
@@ -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 { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
16
|
import { DOMParser } from 'prosemirror-model';
|
|
18
17
|
import { InvalidInput } from '../../errors';
|
|
19
18
|
import { nodeFromHTML } from '../../lib/html';
|
|
@@ -49,16 +48,9 @@ export const parseJATSFront = async (front) => {
|
|
|
49
48
|
const title = (_a = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > article-title')) === null || _a === void 0 ? void 0 : _a.innerHTML;
|
|
50
49
|
const subtitle = (_b = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > subtitle')) === null || _b === void 0 ? void 0 : _b.innerHTML;
|
|
51
50
|
const runningTitle = (_c = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > alt-title[alt-title-type="right-running"]')) === null || _c === void 0 ? void 0 : _c.innerHTML;
|
|
52
|
-
const manuscriptMeta = Object.assign({
|
|
53
|
-
const titles = {
|
|
54
|
-
objectType: ObjectTypes.Titles,
|
|
55
|
-
_id: generateID(ObjectTypes.Titles),
|
|
56
|
-
title: title ? inlineContentsFromJATSTitle(title) : undefined,
|
|
57
|
-
subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined,
|
|
58
|
-
runningTitle: runningTitle
|
|
51
|
+
const manuscriptMeta = Object.assign({ title: title ? inlineContentsFromJATSTitle(title) : undefined, subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined, runningTitle: runningTitle
|
|
59
52
|
? inlineContentsFromJATSTitle(runningTitle)
|
|
60
|
-
: undefined,
|
|
61
|
-
};
|
|
53
|
+
: undefined }, jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
|
|
62
54
|
const { affiliations, affiliationIDs } = jatsFrontParser.parseAffiliationNodes([
|
|
63
55
|
...front.querySelectorAll('article-meta > contrib-group > aff'),
|
|
64
56
|
]);
|
|
@@ -78,7 +70,6 @@ export const parseJATSFront = async (front) => {
|
|
|
78
70
|
const manuscript = Object.assign(Object.assign(Object.assign({}, buildManuscript()), manuscriptMeta), history);
|
|
79
71
|
return {
|
|
80
72
|
models: generateModelIDs([
|
|
81
|
-
titles,
|
|
82
73
|
manuscript,
|
|
83
74
|
...footnotes,
|
|
84
75
|
...correspondingList,
|
|
@@ -25,7 +25,7 @@ import { generateAttachmentFilename } from '../transformer/filename';
|
|
|
25
25
|
import { buildTargets } from '../transformer/labels';
|
|
26
26
|
import { isExecutableNodeType, isNodeType } from '../transformer/node-types';
|
|
27
27
|
import { hasObjectType } from '../transformer/object-types';
|
|
28
|
-
import { findManuscript, findManuscriptById,
|
|
28
|
+
import { findManuscript, findManuscriptById, } from '../transformer/project-bundle';
|
|
29
29
|
import { chooseJatsFnType, chooseSecType, } from '../transformer/section-category';
|
|
30
30
|
import { selectVersionIds } from './jats-versions';
|
|
31
31
|
const warn = debug('manuscripts-transform');
|
|
@@ -231,7 +231,6 @@ export class JATSExporter {
|
|
|
231
231
|
this.buildFront = (doi, id, links) => {
|
|
232
232
|
var _a, _b, _c, _d;
|
|
233
233
|
const manuscript = findManuscript(this.modelMap);
|
|
234
|
-
const titles = findTitles(this.modelMap);
|
|
235
234
|
const front = this.document.createElement('front');
|
|
236
235
|
const journalMeta = this.document.createElement('journal-meta');
|
|
237
236
|
front.appendChild(journalMeta);
|
|
@@ -309,20 +308,20 @@ export class JATSExporter {
|
|
|
309
308
|
articleMeta.appendChild(link);
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
|
-
if (
|
|
311
|
+
if (manuscript.title) {
|
|
313
312
|
const element = this.document.createElement('article-title');
|
|
314
|
-
this.setTitleContent(element,
|
|
313
|
+
this.setTitleContent(element, manuscript.title);
|
|
315
314
|
titleGroup.appendChild(element);
|
|
316
315
|
}
|
|
317
|
-
if (
|
|
316
|
+
if (manuscript.subtitle) {
|
|
318
317
|
const element = this.document.createElement('subtitle');
|
|
319
|
-
this.setTitleContent(element,
|
|
318
|
+
this.setTitleContent(element, manuscript.subtitle);
|
|
320
319
|
titleGroup.appendChild(element);
|
|
321
320
|
}
|
|
322
|
-
if (
|
|
321
|
+
if (manuscript.runningTitle) {
|
|
323
322
|
const element = this.document.createElement('alt-title');
|
|
324
323
|
element.setAttribute('alt-title-type', 'right-running');
|
|
325
|
-
this.setTitleContent(element,
|
|
324
|
+
this.setTitleContent(element, manuscript.runningTitle);
|
|
326
325
|
titleGroup.appendChild(element);
|
|
327
326
|
}
|
|
328
327
|
const supplements = [...this.modelMap.values()].filter((model) => model.objectType === ObjectTypes.Supplement);
|
|
@@ -592,7 +591,6 @@ export class JATSExporter {
|
|
|
592
591
|
this.createSerializer = () => {
|
|
593
592
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
594
593
|
const nodes = {
|
|
595
|
-
title: () => '',
|
|
596
594
|
affiliations_section: () => '',
|
|
597
595
|
contributors_section: () => '',
|
|
598
596
|
table_element_footer: () => ['table-wrap-foot', 0],
|
package/dist/es/schema/index.js
CHANGED
|
@@ -68,7 +68,6 @@ import { tableElement } from './nodes/table_element';
|
|
|
68
68
|
import { tableElementFooter } from './nodes/table_element_footer';
|
|
69
69
|
import { tableCell, tableRow } from './nodes/table_row';
|
|
70
70
|
import { text } from './nodes/text';
|
|
71
|
-
import { title } from './nodes/title';
|
|
72
71
|
import { tocElement } from './nodes/toc_element';
|
|
73
72
|
import { tocSection } from './nodes/toc_section';
|
|
74
73
|
export * from './groups';
|
|
@@ -124,7 +123,6 @@ export * from './nodes/affiliation';
|
|
|
124
123
|
export * from './nodes/meta_section';
|
|
125
124
|
export * from './nodes/contributor';
|
|
126
125
|
export * from './nodes/table_element_footer';
|
|
127
|
-
export * from './nodes/title';
|
|
128
126
|
export * from './nodes/affiliations_section';
|
|
129
127
|
export * from './nodes/contributors_section';
|
|
130
128
|
export const schema = new Schema({
|
|
@@ -201,7 +199,6 @@ export const schema = new Schema({
|
|
|
201
199
|
meta_section: metaSection,
|
|
202
200
|
contributor: contributor,
|
|
203
201
|
table_element_footer: tableElementFooter,
|
|
204
|
-
title: title,
|
|
205
202
|
affiliations_section: affiliationsSection,
|
|
206
203
|
contributors_section: contributorsSection,
|
|
207
204
|
},
|
|
@@ -28,9 +28,10 @@ export const buildProject = (owner) => ({
|
|
|
28
28
|
viewers: [],
|
|
29
29
|
title: '',
|
|
30
30
|
});
|
|
31
|
-
export const buildManuscript = () => ({
|
|
31
|
+
export const buildManuscript = (title = '') => ({
|
|
32
32
|
_id: generateID(ObjectTypes.Manuscript),
|
|
33
33
|
objectType: ObjectTypes.Manuscript,
|
|
34
|
+
title,
|
|
34
35
|
});
|
|
35
36
|
export const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
|
|
36
37
|
_id: generateID(ObjectTypes.Contributor),
|
|
@@ -248,8 +249,3 @@ export const buildElementsOrder = (elementType) => ({
|
|
|
248
249
|
elementType: elementType,
|
|
249
250
|
elements: [],
|
|
250
251
|
});
|
|
251
|
-
export const buildTitles = (title) => ({
|
|
252
|
-
_id: generateID(ObjectTypes.Titles),
|
|
253
|
-
objectType: ObjectTypes.Titles,
|
|
254
|
-
title: title || '',
|
|
255
|
-
});
|
|
@@ -29,7 +29,6 @@ import debug from 'debug';
|
|
|
29
29
|
import { DOMParser } from 'prosemirror-model';
|
|
30
30
|
import { MissingElement } from '../errors';
|
|
31
31
|
import { schema, } from '../schema';
|
|
32
|
-
import { buildTitles } from './builders';
|
|
33
32
|
import { insertHighlightMarkers } from './highlight-markers';
|
|
34
33
|
import { generateNodeID } from './id';
|
|
35
34
|
import { ExtraObjectTypes, hasObjectType, isCommentAnnotation, isManuscript, } from './object-types';
|
|
@@ -106,11 +105,6 @@ export class Decoder {
|
|
|
106
105
|
rootSectionNodes.unshift(node);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
createTitleNode() {
|
|
110
|
-
const titles = getModelsByType(this.modelMap, ObjectTypes.Titles)[0] ||
|
|
111
|
-
buildTitles();
|
|
112
|
-
return this.decode(titles);
|
|
113
|
-
}
|
|
114
108
|
createRootSectionNodes() {
|
|
115
109
|
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
116
110
|
rootSections = this.addGeneratedLabels(rootSections);
|
|
@@ -143,14 +137,6 @@ export class Decoder {
|
|
|
143
137
|
constructor(modelMap, allowMissingElements = false) {
|
|
144
138
|
this.comments = new Map();
|
|
145
139
|
this.creators = {
|
|
146
|
-
[ObjectTypes.Titles]: (data) => {
|
|
147
|
-
const model = data;
|
|
148
|
-
return this.parseContents(model.title, 'div', undefined, {
|
|
149
|
-
topNode: schema.nodes.title.create({
|
|
150
|
-
id: model._id,
|
|
151
|
-
}),
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
140
|
[ObjectTypes.BibliographyElement]: (data) => {
|
|
155
141
|
var _a;
|
|
156
142
|
const model = data;
|
|
@@ -635,14 +621,9 @@ export class Decoder {
|
|
|
635
621
|
};
|
|
636
622
|
this.getModel = (id) => this.modelMap.get(id);
|
|
637
623
|
this.createArticleNode = (manuscriptID) => {
|
|
638
|
-
const titlesNode = this.createTitleNode();
|
|
639
624
|
const rootSectionNodes = this.createRootSectionNodes();
|
|
640
625
|
const metaSectionNode = this.createMetaSectionNode();
|
|
641
|
-
const contents = [
|
|
642
|
-
titlesNode,
|
|
643
|
-
...rootSectionNodes,
|
|
644
|
-
metaSectionNode,
|
|
645
|
-
];
|
|
626
|
+
const contents = [...rootSectionNodes, metaSectionNode];
|
|
646
627
|
return schema.nodes.manuscript.create({
|
|
647
628
|
id: manuscriptID || this.getManuscriptID(),
|
|
648
629
|
}, contents);
|
|
@@ -255,12 +255,6 @@ function figureElementEncoder(node) {
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
const encoders = {
|
|
258
|
-
title: (node) => ({
|
|
259
|
-
title: node.attrs.title,
|
|
260
|
-
subtitle: node.attrs.subtitle,
|
|
261
|
-
runningTitle: node.attrs.runningTitle,
|
|
262
|
-
_id: node.attrs._id,
|
|
263
|
-
}),
|
|
264
258
|
bibliography_element: (node) => ({
|
|
265
259
|
elementType: 'div',
|
|
266
260
|
contents: '',
|
|
@@ -23,7 +23,7 @@ import { generateAttachmentFilename } from './filename';
|
|
|
23
23
|
import { buildTargets } from './labels';
|
|
24
24
|
import { isNodeType } from './node-types';
|
|
25
25
|
import { hasObjectType } from './object-types';
|
|
26
|
-
import { findJournal, findManuscript
|
|
26
|
+
import { findJournal, findManuscript } from './project-bundle';
|
|
27
27
|
import { chooseSecType } from './section-category';
|
|
28
28
|
const chooseNodeName = (element) => {
|
|
29
29
|
const nodeName = element.nodeName.toLowerCase();
|
|
@@ -146,7 +146,6 @@ export class HTMLTransformer {
|
|
|
146
146
|
this.buildFront = () => {
|
|
147
147
|
const manuscript = findManuscript(this.modelMap);
|
|
148
148
|
const journal = findJournal(this.modelMap);
|
|
149
|
-
const titles = findTitles(this.modelMap);
|
|
150
149
|
if (!manuscript) {
|
|
151
150
|
throw new Error('Manuscript not found in project modelMap');
|
|
152
151
|
}
|
|
@@ -165,14 +164,14 @@ export class HTMLTransformer {
|
|
|
165
164
|
}
|
|
166
165
|
const articleMeta = this.document.createElement('div');
|
|
167
166
|
front.appendChild(articleMeta);
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
|
|
167
|
+
const articleTitle = this.document.createElement('h1');
|
|
168
|
+
if (manuscript.title) {
|
|
169
|
+
articleTitle.innerHTML = manuscript.title;
|
|
171
170
|
}
|
|
172
171
|
if (journal === null || journal === void 0 ? void 0 : journal.title) {
|
|
173
|
-
|
|
172
|
+
articleTitle.setAttribute('data-journal', journal.title);
|
|
174
173
|
}
|
|
175
|
-
articleMeta.appendChild(
|
|
174
|
+
articleMeta.appendChild(articleTitle);
|
|
176
175
|
if (manuscript.DOI) {
|
|
177
176
|
const articleID = this.document.createElement('article-id');
|
|
178
177
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
@@ -53,10 +53,14 @@ export const buildTargets = (fragment, manuscript) => {
|
|
|
53
53
|
const targets = new Map();
|
|
54
54
|
const figures = [];
|
|
55
55
|
fragment.forEach((node) => {
|
|
56
|
-
if (node.
|
|
57
|
-
node.forEach((
|
|
58
|
-
if (
|
|
59
|
-
|
|
56
|
+
if (node.attrs.category === 'MPSectionCategory:abstracts') {
|
|
57
|
+
node.forEach((child) => {
|
|
58
|
+
if (child.type === node.type.schema.nodes.graphical_abstract_section) {
|
|
59
|
+
child.forEach((item) => {
|
|
60
|
+
if (item.type === node.type.schema.nodes.figure_element) {
|
|
61
|
+
figures.push(item.attrs.id);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
60
64
|
}
|
|
61
65
|
});
|
|
62
66
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { iterateChildren } from '../lib/utils';
|
|
17
|
-
import { isHighlightMarkerNode
|
|
17
|
+
import { isHighlightMarkerNode } from '../schema';
|
|
18
18
|
import { nodeNames } from './node-names';
|
|
19
19
|
const textSnippet = (node, max = 100) => {
|
|
20
20
|
let text = '';
|
|
@@ -29,7 +29,7 @@ const textSnippet = (node, max = 100) => {
|
|
|
29
29
|
text += ' ';
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
return text.
|
|
32
|
+
return text.substr(0, max);
|
|
33
33
|
};
|
|
34
34
|
const snippetOfNodeType = (node, nodeType) => {
|
|
35
35
|
for (const child of iterateChildren(node, true)) {
|
|
@@ -40,10 +40,8 @@ const snippetOfNodeType = (node, nodeType) => {
|
|
|
40
40
|
return null;
|
|
41
41
|
};
|
|
42
42
|
export const nodeTitle = (node) => {
|
|
43
|
-
const nodes = schema.nodes;
|
|
43
|
+
const nodes = node.type.schema.nodes;
|
|
44
44
|
switch (node.type) {
|
|
45
|
-
case nodes.manuscript:
|
|
46
|
-
return snippetOfNodeType(node, nodes.title);
|
|
47
45
|
case nodes.section:
|
|
48
46
|
case nodes.bibliography_section:
|
|
49
47
|
case nodes.footnotes_section:
|
|
@@ -70,9 +68,9 @@ export const nodeTitle = (node) => {
|
|
|
70
68
|
}
|
|
71
69
|
};
|
|
72
70
|
export const nodeTitlePlaceholder = (nodeType) => {
|
|
73
|
-
const nodes = schema.nodes;
|
|
71
|
+
const nodes = nodeType.schema.nodes;
|
|
74
72
|
switch (nodeType) {
|
|
75
|
-
case nodes.
|
|
73
|
+
case nodes.title:
|
|
76
74
|
return 'Untitled Manuscript';
|
|
77
75
|
case nodes.section:
|
|
78
76
|
return 'Untitled Section';
|
|
@@ -54,7 +54,6 @@ export const nodeTypesMap = new Map([
|
|
|
54
54
|
[schema.nodes.affiliation, ObjectTypes.Affiliation],
|
|
55
55
|
[schema.nodes.contributor, ObjectTypes.Contributor],
|
|
56
56
|
[schema.nodes.table_element_footer, ObjectTypes.TableElementFooter],
|
|
57
|
-
[schema.nodes.title, ObjectTypes.Titles],
|
|
58
57
|
[schema.nodes.contributors_section, ObjectTypes.Section],
|
|
59
58
|
[schema.nodes.affiliations_section, ObjectTypes.Section],
|
|
60
59
|
]);
|
|
@@ -63,23 +63,3 @@ export const findManuscriptById = (modelMap, manuscriptID) => {
|
|
|
63
63
|
}
|
|
64
64
|
throw new Error(`There is no manuscript found for the following _id (${manuscriptID})`);
|
|
65
65
|
};
|
|
66
|
-
const isTitle = hasObjectType(ObjectTypes.Titles);
|
|
67
|
-
export const findTitles = (modelMap) => {
|
|
68
|
-
for (const model of modelMap.values()) {
|
|
69
|
-
if (isTitle(model)) {
|
|
70
|
-
return model;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const defaultTitle = {
|
|
74
|
-
_id: 'MPTitles:8EB79C14-9F61-483A-902F-A0B8EF5973C1',
|
|
75
|
-
createdAt: 1538472121.690101,
|
|
76
|
-
updatedAt: 1538472121.690101,
|
|
77
|
-
objectType: 'MPTitles',
|
|
78
|
-
title: 'main title',
|
|
79
|
-
subtitle: 'subtitle',
|
|
80
|
-
runningTitle: 'running title',
|
|
81
|
-
manuscriptID: 'MPManuscript:E3830344-E77B-42BA-BD77-3E95489712A0',
|
|
82
|
-
containerID: 'MPProject:1',
|
|
83
|
-
};
|
|
84
|
-
return defaultTitle;
|
|
85
|
-
};
|
|
@@ -68,7 +68,6 @@ export * from './nodes/affiliation';
|
|
|
68
68
|
export * from './nodes/meta_section';
|
|
69
69
|
export * from './nodes/contributor';
|
|
70
70
|
export * from './nodes/table_element_footer';
|
|
71
|
-
export * from './nodes/title';
|
|
72
71
|
export * from './nodes/affiliations_section';
|
|
73
72
|
export * from './nodes/contributors_section';
|
|
74
73
|
export declare const schema: Schema<Nodes, Marks>;
|
|
@@ -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' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | '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' | '
|
|
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' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | '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' | 'affiliations_section' | 'contributors_section';
|
|
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,
|
|
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';
|
|
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: () => Build<Manuscript>;
|
|
31
|
+
export declare const buildManuscript: (title?: string) => 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,4 +70,3 @@ 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>;
|
|
@@ -30,7 +30,6 @@ export declare class Decoder {
|
|
|
30
30
|
private handleMissingRootSectionNodes;
|
|
31
31
|
private createAffiliationSectionNode;
|
|
32
32
|
private createContributorSectionNode;
|
|
33
|
-
private createTitleNode;
|
|
34
33
|
private createRootSectionNodes;
|
|
35
34
|
private createCommentsNode;
|
|
36
35
|
private getComments;
|
|
@@ -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
|
|
16
|
+
import { Journal, Manuscript, Model, ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel } from './models';
|
|
18
18
|
export interface ProjectBundle {
|
|
19
19
|
version: string;
|
|
@@ -27,4 +27,3 @@ 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;
|
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.2",
|
|
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": "2.2.0
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.0",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"jszip": "^3.10.1",
|
|
35
35
|
"mathjax-full": "^3.2.2",
|
|
@@ -1,29 +0,0 @@
|
|
|
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.title = void 0;
|
|
19
|
-
exports.title = {
|
|
20
|
-
content: 'text*',
|
|
21
|
-
marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
|
|
22
|
-
attrs: {
|
|
23
|
-
id: { default: '' },
|
|
24
|
-
dataTracked: { default: null },
|
|
25
|
-
},
|
|
26
|
-
group: 'block element',
|
|
27
|
-
parseDOM: [{ tag: 'div' }],
|
|
28
|
-
toDOM: () => ['div', 0],
|
|
29
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
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 title = {
|
|
17
|
-
content: 'text*',
|
|
18
|
-
marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
|
|
19
|
-
attrs: {
|
|
20
|
-
id: { default: '' },
|
|
21
|
-
dataTracked: { default: null },
|
|
22
|
-
},
|
|
23
|
-
group: 'block element',
|
|
24
|
-
parseDOM: [{ tag: 'div' }],
|
|
25
|
-
toDOM: () => ['div', 0],
|
|
26
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
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 {};
|