@manuscripts/transform 3.0.23-LEAN-4195.1 → 3.0.23

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.
@@ -872,7 +872,12 @@ class JATSExporter {
872
872
  return element;
873
873
  };
874
874
  const appendLabels = (element, node) => {
875
- if (this.labelTargets) {
875
+ if (node.attrs.label) {
876
+ const label = this.document.createElement('label');
877
+ label.textContent = node.attrs.label;
878
+ element.appendChild(label);
879
+ }
880
+ else if (this.labelTargets) {
876
881
  const target = this.labelTargets.get(node.attrs.id);
877
882
  if (target) {
878
883
  const label = this.document.createElement('label');
@@ -504,9 +504,11 @@ class JATSDOMParser {
504
504
  tag: 'disp-formula',
505
505
  node: 'equation_element',
506
506
  getAttrs: (node) => {
507
+ var _a;
507
508
  const element = node;
508
509
  return {
509
510
  id: element.getAttribute('id'),
511
+ label: (_a = (0, utils_1.getTrimmedTextContent)(element, 'label')) !== null && _a !== void 0 ? _a : '',
510
512
  };
511
513
  },
512
514
  getContent: (node, schema) => {
@@ -612,8 +614,12 @@ class JATSDOMParser {
612
614
  tag: 'fig',
613
615
  node: 'figure_element',
614
616
  getAttrs: (node) => {
615
- var _a;
617
+ var _a, _b;
616
618
  const element = node;
619
+ const labelNode = element.querySelector('label');
620
+ if (labelNode) {
621
+ element.removeChild(labelNode);
622
+ }
617
623
  const attrib = element.querySelector('attrib');
618
624
  const attribution = attrib
619
625
  ? {
@@ -622,6 +628,7 @@ class JATSDOMParser {
622
628
  : undefined;
623
629
  return {
624
630
  id: element.getAttribute('id'),
631
+ label: (_b = (0, utils_1.getTrimmedTextContent)(labelNode)) !== null && _b !== void 0 ? _b : '',
625
632
  attribution,
626
633
  type: element.getAttribute('fig-type'),
627
634
  };
@@ -768,6 +775,7 @@ class JATSDOMParser {
768
775
  const element = node;
769
776
  return {
770
777
  id: element.getAttribute('id'),
778
+ label: (0, utils_1.getTrimmedTextContent)(element, 'label'),
771
779
  };
772
780
  },
773
781
  },
@@ -823,6 +831,11 @@ class JATSDOMParser {
823
831
  context: 'keyword_group//',
824
832
  node: 'keyword',
825
833
  },
834
+ {
835
+ tag: 'label',
836
+ context: 'box_element/',
837
+ ignore: true,
838
+ },
826
839
  {
827
840
  tag: 'boxed-text',
828
841
  ignore: true,
@@ -832,6 +845,16 @@ class JATSDOMParser {
832
845
  context: 'section/',
833
846
  node: 'section_label',
834
847
  },
848
+ {
849
+ tag: 'label',
850
+ context: 'table_element/',
851
+ ignore: true,
852
+ },
853
+ {
854
+ tag: 'label',
855
+ context: 'figure/',
856
+ ignore: true,
857
+ },
835
858
  {
836
859
  tag: 'table',
837
860
  node: 'table',
@@ -935,10 +958,6 @@ class JATSDOMParser {
935
958
  };
936
959
  },
937
960
  },
938
- {
939
- tag: 'label',
940
- ignore: true,
941
- },
942
961
  ];
943
962
  this.marks = [
944
963
  {
@@ -101,6 +101,8 @@ __exportStar(require("./nodes/affiliation"), exports);
101
101
  __exportStar(require("./nodes/affiliations"), exports);
102
102
  __exportStar(require("./nodes/attribution"), exports);
103
103
  __exportStar(require("./nodes/author_notes"), exports);
104
+ __exportStar(require("./nodes/award"), exports);
105
+ __exportStar(require("./nodes/awards"), exports);
104
106
  __exportStar(require("./nodes/bibliography_element"), exports);
105
107
  __exportStar(require("./nodes/bibliography_item"), exports);
106
108
  __exportStar(require("./nodes/bibliography_section"), exports);
@@ -20,6 +20,7 @@ exports.box_element = {
20
20
  content: 'figcaption? section?',
21
21
  attrs: {
22
22
  id: { default: '' },
23
+ label: { default: '' },
23
24
  dataTracked: { default: null },
24
25
  },
25
26
  group: 'block element',
@@ -31,6 +32,7 @@ exports.box_element = {
31
32
  const dom = p;
32
33
  const attrs = {
33
34
  id: dom.getAttribute('id') || undefined,
35
+ label: dom.getAttribute('label') || undefined,
34
36
  };
35
37
  return attrs;
36
38
  },
@@ -42,6 +44,9 @@ exports.box_element = {
42
44
  if (boxElementNode.attrs.id) {
43
45
  attrs.id = boxElementNode.attrs.id;
44
46
  }
47
+ if (boxElementNode.attrs.label) {
48
+ attrs.label = boxElementNode.attrs.label;
49
+ }
45
50
  return [
46
51
  'div',
47
52
  Object.assign({ class: 'boxed-text' }, attrs),
@@ -20,6 +20,7 @@ exports.tableElement = {
20
20
  content: ' figcaption? (table | placeholder) table_colgroup? table_element_footer? (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
+ label: { default: '' },
23
24
  dataTracked: { default: null },
24
25
  },
25
26
  selectable: false,
@@ -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.23-LEAN-4195.1";
4
+ exports.VERSION = "3.0.23";
@@ -864,7 +864,12 @@ export class JATSExporter {
864
864
  return element;
865
865
  };
866
866
  const appendLabels = (element, node) => {
867
- if (this.labelTargets) {
867
+ if (node.attrs.label) {
868
+ const label = this.document.createElement('label');
869
+ label.textContent = node.attrs.label;
870
+ element.appendChild(label);
871
+ }
872
+ else if (this.labelTargets) {
868
873
  const target = this.labelTargets.get(node.attrs.id);
869
874
  if (target) {
870
875
  const label = this.document.createElement('label');
@@ -498,9 +498,11 @@ export class JATSDOMParser {
498
498
  tag: 'disp-formula',
499
499
  node: 'equation_element',
500
500
  getAttrs: (node) => {
501
+ var _a;
501
502
  const element = node;
502
503
  return {
503
504
  id: element.getAttribute('id'),
505
+ label: (_a = getTrimmedTextContent(element, 'label')) !== null && _a !== void 0 ? _a : '',
504
506
  };
505
507
  },
506
508
  getContent: (node, schema) => {
@@ -606,8 +608,12 @@ export class JATSDOMParser {
606
608
  tag: 'fig',
607
609
  node: 'figure_element',
608
610
  getAttrs: (node) => {
609
- var _a;
611
+ var _a, _b;
610
612
  const element = node;
613
+ const labelNode = element.querySelector('label');
614
+ if (labelNode) {
615
+ element.removeChild(labelNode);
616
+ }
611
617
  const attrib = element.querySelector('attrib');
612
618
  const attribution = attrib
613
619
  ? {
@@ -616,6 +622,7 @@ export class JATSDOMParser {
616
622
  : undefined;
617
623
  return {
618
624
  id: element.getAttribute('id'),
625
+ label: (_b = getTrimmedTextContent(labelNode)) !== null && _b !== void 0 ? _b : '',
619
626
  attribution,
620
627
  type: element.getAttribute('fig-type'),
621
628
  };
@@ -762,6 +769,7 @@ export class JATSDOMParser {
762
769
  const element = node;
763
770
  return {
764
771
  id: element.getAttribute('id'),
772
+ label: getTrimmedTextContent(element, 'label'),
765
773
  };
766
774
  },
767
775
  },
@@ -817,6 +825,11 @@ export class JATSDOMParser {
817
825
  context: 'keyword_group//',
818
826
  node: 'keyword',
819
827
  },
828
+ {
829
+ tag: 'label',
830
+ context: 'box_element/',
831
+ ignore: true,
832
+ },
820
833
  {
821
834
  tag: 'boxed-text',
822
835
  ignore: true,
@@ -826,6 +839,16 @@ export class JATSDOMParser {
826
839
  context: 'section/',
827
840
  node: 'section_label',
828
841
  },
842
+ {
843
+ tag: 'label',
844
+ context: 'table_element/',
845
+ ignore: true,
846
+ },
847
+ {
848
+ tag: 'label',
849
+ context: 'figure/',
850
+ ignore: true,
851
+ },
829
852
  {
830
853
  tag: 'table',
831
854
  node: 'table',
@@ -929,10 +952,6 @@ export class JATSDOMParser {
929
952
  };
930
953
  },
931
954
  },
932
- {
933
- tag: 'label',
934
- ignore: true,
935
- },
936
955
  ];
937
956
  this.marks = [
938
957
  {
@@ -84,6 +84,8 @@ export * from './nodes/affiliation';
84
84
  export * from './nodes/affiliations';
85
85
  export * from './nodes/attribution';
86
86
  export * from './nodes/author_notes';
87
+ export * from './nodes/award';
88
+ export * from './nodes/awards';
87
89
  export * from './nodes/bibliography_element';
88
90
  export * from './nodes/bibliography_item';
89
91
  export * from './nodes/bibliography_section';
@@ -17,6 +17,7 @@ export const box_element = {
17
17
  content: 'figcaption? section?',
18
18
  attrs: {
19
19
  id: { default: '' },
20
+ label: { default: '' },
20
21
  dataTracked: { default: null },
21
22
  },
22
23
  group: 'block element',
@@ -28,6 +29,7 @@ export const box_element = {
28
29
  const dom = p;
29
30
  const attrs = {
30
31
  id: dom.getAttribute('id') || undefined,
32
+ label: dom.getAttribute('label') || undefined,
31
33
  };
32
34
  return attrs;
33
35
  },
@@ -39,6 +41,9 @@ export const box_element = {
39
41
  if (boxElementNode.attrs.id) {
40
42
  attrs.id = boxElementNode.attrs.id;
41
43
  }
44
+ if (boxElementNode.attrs.label) {
45
+ attrs.label = boxElementNode.attrs.label;
46
+ }
42
47
  return [
43
48
  'div',
44
49
  Object.assign({ class: 'boxed-text' }, attrs),
@@ -17,6 +17,7 @@ export const tableElement = {
17
17
  content: ' figcaption? (table | placeholder) table_colgroup? table_element_footer? (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
+ label: { default: '' },
20
21
  dataTracked: { default: null },
21
22
  },
22
23
  selectable: false,
@@ -1 +1 @@
1
- export const VERSION = "3.0.23-LEAN-4195.1";
1
+ export const VERSION = "3.0.23";
@@ -20,6 +20,8 @@ export * from './nodes/affiliation';
20
20
  export * from './nodes/affiliations';
21
21
  export * from './nodes/attribution';
22
22
  export * from './nodes/author_notes';
23
+ export * from './nodes/award';
24
+ export * from './nodes/awards';
23
25
  export * from './nodes/bibliography_element';
24
26
  export * from './nodes/bibliography_item';
25
27
  export * from './nodes/bibliography_section';
@@ -17,6 +17,7 @@ import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
19
  id: string;
20
+ label: string;
20
21
  }
21
22
  export interface BoxElementNode extends ManuscriptNode {
22
23
  attrs: Attrs;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.23-LEAN-4195.1";
1
+ export declare const VERSION = "3.0.23";
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.23-LEAN-4195.1",
4
+ "version": "3.0.23",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",