@manuscripts/transform 3.0.31-LEAN-4218.0 → 3.0.31

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.
Files changed (30) hide show
  1. package/dist/cjs/jats/exporter/jats-exporter.js +1 -0
  2. package/dist/cjs/jats/exporter/labels.js +0 -1
  3. package/dist/cjs/jats/importer/jats-dom-parser.js +1 -1
  4. package/dist/cjs/jats/importer/jats-transformations.js +1 -1
  5. package/dist/cjs/schema/index.js +1 -0
  6. package/dist/cjs/schema/migration/migration-scripts/3.0.22.js +21 -0
  7. package/dist/cjs/schema/migration/migration-scripts/index.js +2 -0
  8. package/dist/cjs/schema/nodes/embed.js +0 -1
  9. package/dist/cjs/schema/nodes/table.js +1 -1
  10. package/dist/cjs/schema/nodes/text.js +5 -1
  11. package/dist/cjs/transformer/node-names.js +1 -1
  12. package/dist/cjs/version.js +1 -1
  13. package/dist/es/jats/exporter/jats-exporter.js +1 -0
  14. package/dist/es/jats/exporter/labels.js +0 -1
  15. package/dist/es/jats/importer/jats-dom-parser.js +1 -1
  16. package/dist/es/jats/importer/jats-transformations.js +1 -1
  17. package/dist/es/schema/index.js +2 -1
  18. package/dist/es/schema/migration/migration-scripts/3.0.22.js +19 -0
  19. package/dist/es/schema/migration/migration-scripts/index.js +2 -0
  20. package/dist/es/schema/nodes/embed.js +0 -1
  21. package/dist/es/schema/nodes/table.js +1 -1
  22. package/dist/es/schema/nodes/text.js +4 -0
  23. package/dist/es/transformer/node-names.js +1 -1
  24. package/dist/es/version.js +1 -1
  25. package/dist/types/schema/migration/migration-scripts/3.0.22.d.ts +8 -0
  26. package/dist/types/schema/migration/migration-scripts/index.d.ts +2 -1
  27. package/dist/types/schema/nodes/text.d.ts +1 -0
  28. package/dist/types/schema/types.d.ts +1 -1
  29. package/dist/types/version.d.ts +1 -1
  30. package/package.json +1 -1
@@ -578,6 +578,7 @@ class JATSExporter {
578
578
  author_notes: () => '',
579
579
  corresp: () => '',
580
580
  title: () => '',
581
+ text_block: (node) => nodes.paragraph(node),
581
582
  affiliations: () => '',
582
583
  contributors: () => '',
583
584
  table_element_footer: (node) => node.childCount == 0
@@ -24,7 +24,6 @@ const labelledNodeTypes = [
24
24
  schema_1.schema.nodes.equation_element,
25
25
  schema_1.schema.nodes.listing_element,
26
26
  schema_1.schema.nodes.box_element,
27
- schema_1.schema.nodes.embed,
28
27
  ];
29
28
  const excludedTypes = [schema_1.schema.nodes.graphical_abstract_section];
30
29
  const chooseLabel = (nodeType) => {
@@ -431,7 +431,7 @@ class JATSDOMParser {
431
431
  {
432
432
  tag: 'caption',
433
433
  node: 'figcaption',
434
- context: 'figure/|embed/',
434
+ context: 'figure/',
435
435
  },
436
436
  {
437
437
  tag: 'caption',
@@ -26,7 +26,7 @@ const createSectionGroup = (type, createElement) => {
26
26
  return sec;
27
27
  };
28
28
  const addMissingCaptions = (doc, createElement) => {
29
- const elements = doc.querySelectorAll('fig, table-wrap, media');
29
+ const elements = doc.querySelectorAll('fig, table-wrap');
30
30
  for (const element of elements) {
31
31
  let caption = element.querySelector('caption');
32
32
  if (!caption) {
@@ -231,6 +231,7 @@ exports.schema = new prosemirror_model_1.Schema({
231
231
  table_colgroup: table_col_1.tableColGroup,
232
232
  table_header: table_1.tableHeader,
233
233
  text: text_1.text,
234
+ text_block: text_1.textBlock,
234
235
  affiliation: affiliation_1.affiliation,
235
236
  contributor: contributor_1.contributor,
236
237
  table_element_footer: table_element_footer_1.tableElementFooter,
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Migration3021 {
4
+ constructor() {
5
+ this.fromVersion = '3.0.21';
6
+ this.toVersion = '3.0.22';
7
+ }
8
+ migrateNode(node) {
9
+ if (node.type === 'table_header' || node.type === 'table_cell') {
10
+ return Object.assign(Object.assign({}, node), { content: [
11
+ {
12
+ type: 'text_block',
13
+ attrs: {},
14
+ content: node.content,
15
+ },
16
+ ] });
17
+ }
18
+ return node;
19
+ }
20
+ }
21
+ exports.default = Migration3021;
@@ -22,12 +22,14 @@ const _1_2_5_1 = __importDefault(require("./1.2.5"));
22
22
  const _2_3_22_1 = __importDefault(require("./2.3.22"));
23
23
  const _3_0_12_1 = require("./3.0.12");
24
24
  const _3_0_21_1 = __importDefault(require("./3.0.21"));
25
+ const _3_0_22_1 = __importDefault(require("./3.0.22"));
25
26
  const _3_0_30_1 = __importDefault(require("./3.0.30"));
26
27
  const migrations = [
27
28
  new _1_2_5_1.default(),
28
29
  new _2_3_22_1.default(),
29
30
  new _3_0_12_1.Migration3012(),
30
31
  new _3_0_21_1.default(),
32
+ new _3_0_22_1.default(),
31
33
  new _3_0_30_1.default(),
32
34
  ];
33
35
  exports.default = migrations;
@@ -17,7 +17,6 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isEmbedNode = exports.embed = void 0;
19
19
  exports.embed = {
20
- content: "figcaption",
21
20
  attrs: {
22
21
  id: { default: '' },
23
22
  dataTracked: { default: null },
@@ -37,7 +37,7 @@ function createCellAttribute(attributeName, defaultValue = null, customGetFromDO
37
37
  };
38
38
  }
39
39
  const tableOptions = {
40
- cellContent: 'inline*',
40
+ cellContent: 'text_block+',
41
41
  cellAttributes: {
42
42
  placeholder: createCellAttribute('data-placeholder-text', 'Data', (dom) => dom.getAttribute('data-placeholder-text') || ''),
43
43
  valign: createCellAttribute('valign'),
@@ -15,7 +15,11 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.text = void 0;
18
+ exports.textBlock = exports.text = void 0;
19
+ const paragraph_1 = require("./paragraph");
19
20
  exports.text = {
20
21
  group: 'inline',
21
22
  };
23
+ exports.textBlock = Object.assign(Object.assign({}, paragraph_1.paragraph), { attrs: {
24
+ dataTracked: { default: null },
25
+ }, group: 'block' });
@@ -37,7 +37,6 @@ exports.nodeNames = new Map([
37
37
  [schema_1.schema.nodes.table_header, 'Table Header'],
38
38
  [schema_1.schema.nodes.general_table_footnote, 'General Table note'],
39
39
  [schema_1.schema.nodes.table_element_footer, 'Table Footer'],
40
- [schema_1.schema.nodes.embed, 'Media'],
41
40
  [schema_1.schema.nodes.equation, 'Equation'],
42
41
  [schema_1.schema.nodes.inline_equation, 'Inline Equation'],
43
42
  [schema_1.schema.nodes.inline_footnote, 'Footnote Reference'],
@@ -48,6 +47,7 @@ exports.nodeNames = new Map([
48
47
  [schema_1.schema.nodes.list_item, 'List Item'],
49
48
  [schema_1.schema.nodes.manuscript, 'Manuscript'],
50
49
  [schema_1.schema.nodes.paragraph, 'Paragraph'],
50
+ [schema_1.schema.nodes.text_block, 'Paragraph'],
51
51
  [schema_1.schema.nodes.section, 'Section'],
52
52
  [schema_1.schema.nodes.section_title, 'Section Title'],
53
53
  [schema_1.schema.nodes.section_title_plain, 'Section Title'],
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "3.0.31-LEAN-4218.0";
4
+ exports.VERSION = "3.0.31";
@@ -570,6 +570,7 @@ export class JATSExporter {
570
570
  author_notes: () => '',
571
571
  corresp: () => '',
572
572
  title: () => '',
573
+ text_block: (node) => nodes.paragraph(node),
573
574
  affiliations: () => '',
574
575
  contributors: () => '',
575
576
  table_element_footer: (node) => node.childCount == 0
@@ -21,7 +21,6 @@ const labelledNodeTypes = [
21
21
  schema.nodes.equation_element,
22
22
  schema.nodes.listing_element,
23
23
  schema.nodes.box_element,
24
- schema.nodes.embed,
25
24
  ];
26
25
  const excludedTypes = [schema.nodes.graphical_abstract_section];
27
26
  const chooseLabel = (nodeType) => {
@@ -428,7 +428,7 @@ export class JATSDOMParser {
428
428
  {
429
429
  tag: 'caption',
430
430
  node: 'figcaption',
431
- context: 'figure/|embed/',
431
+ context: 'figure/',
432
432
  },
433
433
  {
434
434
  tag: 'caption',
@@ -23,7 +23,7 @@ const createSectionGroup = (type, createElement) => {
23
23
  return sec;
24
24
  };
25
25
  export const addMissingCaptions = (doc, createElement) => {
26
- const elements = doc.querySelectorAll('fig, table-wrap, media');
26
+ const elements = doc.querySelectorAll('fig, table-wrap');
27
27
  for (const element of elements) {
28
28
  let caption = element.querySelector('caption');
29
29
  if (!caption) {
@@ -78,7 +78,7 @@ import { table, tableCell, tableHeader, tableRow } from './nodes/table';
78
78
  import { tableCol, tableColGroup } from './nodes/table_col';
79
79
  import { tableElement } from './nodes/table_element';
80
80
  import { tableElementFooter } from './nodes/table_element_footer';
81
- import { text } from './nodes/text';
81
+ import { text, textBlock } from './nodes/text';
82
82
  import { title } from './nodes/title';
83
83
  export * from './groups';
84
84
  export * from './nodes/affiliation';
@@ -214,6 +214,7 @@ export const schema = new Schema({
214
214
  table_colgroup: tableColGroup,
215
215
  table_header: tableHeader,
216
216
  text,
217
+ text_block: textBlock,
217
218
  affiliation,
218
219
  contributor: contributor,
219
220
  table_element_footer: tableElementFooter,
@@ -0,0 +1,19 @@
1
+ class Migration3021 {
2
+ constructor() {
3
+ this.fromVersion = '3.0.21';
4
+ this.toVersion = '3.0.22';
5
+ }
6
+ migrateNode(node) {
7
+ if (node.type === 'table_header' || node.type === 'table_cell') {
8
+ return Object.assign(Object.assign({}, node), { content: [
9
+ {
10
+ type: 'text_block',
11
+ attrs: {},
12
+ content: node.content,
13
+ },
14
+ ] });
15
+ }
16
+ return node;
17
+ }
18
+ }
19
+ export default Migration3021;
@@ -17,12 +17,14 @@ import Migration125 from './1.2.5';
17
17
  import Migration2322 from './2.3.22';
18
18
  import { Migration3012 } from './3.0.12';
19
19
  import Migration3021 from './3.0.21';
20
+ import Migration3022 from './3.0.22';
20
21
  import Migration3030 from './3.0.30';
21
22
  const migrations = [
22
23
  new Migration125(),
23
24
  new Migration2322(),
24
25
  new Migration3012(),
25
26
  new Migration3021(),
27
+ new Migration3022(),
26
28
  new Migration3030(),
27
29
  ];
28
30
  export default migrations;
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const embed = {
17
- content: "figcaption",
18
17
  attrs: {
19
18
  id: { default: '' },
20
19
  dataTracked: { default: null },
@@ -34,7 +34,7 @@ function createCellAttribute(attributeName, defaultValue = null, customGetFromDO
34
34
  };
35
35
  }
36
36
  const tableOptions = {
37
- cellContent: 'inline*',
37
+ cellContent: 'text_block+',
38
38
  cellAttributes: {
39
39
  placeholder: createCellAttribute('data-placeholder-text', 'Data', (dom) => dom.getAttribute('data-placeholder-text') || ''),
40
40
  valign: createCellAttribute('valign'),
@@ -13,6 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { paragraph } from './paragraph';
16
17
  export const text = {
17
18
  group: 'inline',
18
19
  };
20
+ export const textBlock = Object.assign(Object.assign({}, paragraph), { attrs: {
21
+ dataTracked: { default: null },
22
+ }, group: 'block' });
@@ -34,7 +34,6 @@ export const nodeNames = new Map([
34
34
  [schema.nodes.table_header, 'Table Header'],
35
35
  [schema.nodes.general_table_footnote, 'General Table note'],
36
36
  [schema.nodes.table_element_footer, 'Table Footer'],
37
- [schema.nodes.embed, 'Media'],
38
37
  [schema.nodes.equation, 'Equation'],
39
38
  [schema.nodes.inline_equation, 'Inline Equation'],
40
39
  [schema.nodes.inline_footnote, 'Footnote Reference'],
@@ -45,6 +44,7 @@ export const nodeNames = new Map([
45
44
  [schema.nodes.list_item, 'List Item'],
46
45
  [schema.nodes.manuscript, 'Manuscript'],
47
46
  [schema.nodes.paragraph, 'Paragraph'],
47
+ [schema.nodes.text_block, 'Paragraph'],
48
48
  [schema.nodes.section, 'Section'],
49
49
  [schema.nodes.section_title, 'Section Title'],
50
50
  [schema.nodes.section_title_plain, 'Section Title'],
@@ -1 +1 @@
1
- export const VERSION = "3.0.31-LEAN-4218.0";
1
+ export const VERSION = "3.0.31";
@@ -0,0 +1,8 @@
1
+ import { JSONNode } from '../migrate';
2
+ import { MigrationScript } from '../migration-script';
3
+ declare class Migration3021 implements MigrationScript {
4
+ fromVersion: string;
5
+ toVersion: string;
6
+ migrateNode(node: JSONNode): JSONNode;
7
+ }
8
+ export default Migration3021;
@@ -17,6 +17,7 @@ import Migration125 from './1.2.5';
17
17
  import Migration2322 from './2.3.22';
18
18
  import { Migration3012 } from './3.0.12';
19
19
  import Migration3021 from './3.0.21';
20
+ import Migration3022 from './3.0.22';
20
21
  import Migration3030 from './3.0.30';
21
- declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030)[];
22
+ declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3022 | Migration3030)[];
22
23
  export default migrations;
@@ -15,3 +15,4 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  export declare const text: NodeSpec;
18
+ export declare const textBlock: NodeSpec;
@@ -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' | 'embed' | 'image_element';
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' | 'text_block' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award' | 'embed' | 'image_element';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.31-LEAN-4218.0";
1
+ export declare const VERSION = "3.0.31";
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.31-LEAN-4218.0",
4
+ "version": "3.0.31",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",