@manuscripts/transform 1.4.1-LEAN-2737 → 1.4.1-LIT-537312-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.
@@ -651,13 +651,9 @@ const nodes = [
651
651
  getAttrs: (node) => {
652
652
  var _a;
653
653
  const element = node;
654
- const embeddedCitationAttr = element.getAttribute('data-reference-embedded-citation');
655
654
  return {
656
655
  rid: element.getAttribute('rid'),
657
656
  contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
658
- embeddedCitationItems: embeddedCitationAttr
659
- ? JSON.parse(embeddedCitationAttr)
660
- : null,
661
657
  };
662
658
  },
663
659
  },
@@ -158,7 +158,6 @@ exports.jatsReferenceParser = {
158
158
  const citation = (0, builders_1.buildCitation)('', rids);
159
159
  modelNodes.push(citation);
160
160
  crossReferenceNode.setAttribute('rid', citation._id);
161
- crossReferenceNode.setAttribute('data-reference-embedded-citation', JSON.stringify(citation.embeddedCitationItems));
162
161
  }
163
162
  else {
164
163
  crossReferenceNode.removeAttribute('rid');
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.bibliographyElement = void 0;
19
19
  exports.bibliographyElement = {
20
- content: '(bibliography_item | placeholder)*',
20
+ content: 'bibliography_item*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  contents: { default: '' },
@@ -26,22 +26,16 @@ exports.citation = {
26
26
  contents: { default: '' },
27
27
  selectedText: { default: '' },
28
28
  dataTracked: { default: null },
29
- embeddedCitationItems: { default: null },
30
29
  },
31
30
  parseDOM: [
32
31
  {
33
32
  tag: 'span.citation[data-reference-id]',
34
33
  getAttrs: (p) => {
35
34
  const dom = p;
36
- const attr = {
35
+ return {
37
36
  rid: dom.getAttribute('data-reference-id'),
38
37
  contents: dom.innerHTML,
39
38
  };
40
- const embeddedCitationAttr = dom.getAttribute('data-reference-embedded-citation');
41
- if (embeddedCitationAttr) {
42
- attr['embeddedCitationItems'] = JSON.parse(embeddedCitationAttr);
43
- }
44
- return attr;
45
39
  },
46
40
  },
47
41
  ],
@@ -50,9 +44,6 @@ exports.citation = {
50
44
  const dom = document.createElement('span');
51
45
  dom.className = 'citation';
52
46
  dom.setAttribute('data-reference-id', citationNode.attrs.rid);
53
- if (citationNode.attrs.embeddedCitationItems) {
54
- dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
55
- }
56
47
  dom.innerHTML = citationNode.attrs.contents;
57
48
  return dom;
58
49
  },
@@ -140,9 +140,6 @@ class Decoder {
140
140
  return references.push(this.decode(referenceModel));
141
141
  }
142
142
  });
143
- if (!references.length) {
144
- references.push(schema_1.schema.nodes.placeholder.createAndFill());
145
- }
146
143
  return schema_1.schema.nodes.bibliography_element.createChecked({
147
144
  id: model._id,
148
145
  contents: '',
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isMetaNode = exports.isNodeType = exports.isSectionNodeType = exports.isElementNodeType = exports.isExecutableNodeType = exports.nodeTypesMap = void 0;
18
+ exports.isNodeType = exports.isSectionNodeType = exports.isElementNodeType = exports.isExecutableNodeType = exports.nodeTypesMap = void 0;
19
19
  const json_schema_1 = require("@manuscripts/json-schema");
20
20
  const schema_1 = require("../schema");
21
21
  exports.nodeTypesMap = new Map([
@@ -66,8 +66,3 @@ const isSectionNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_
66
66
  exports.isSectionNodeType = isSectionNodeType;
67
67
  const isNodeType = (node, type) => node.type === node.type.schema.nodes[type];
68
68
  exports.isNodeType = isNodeType;
69
- const isMetaNode = (nodeType) => nodeType === schema_1.schema.nodes.bibliography_item.name ||
70
- nodeType === schema_1.schema.nodes.affiliation.name ||
71
- nodeType === schema_1.schema.nodes.contributor.name ||
72
- nodeType === schema_1.schema.nodes.manuscript.name;
73
- exports.isMetaNode = isMetaNode;
@@ -645,13 +645,9 @@ const nodes = [
645
645
  getAttrs: (node) => {
646
646
  var _a;
647
647
  const element = node;
648
- const embeddedCitationAttr = element.getAttribute('data-reference-embedded-citation');
649
648
  return {
650
649
  rid: element.getAttribute('rid'),
651
650
  contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
652
- embeddedCitationItems: embeddedCitationAttr
653
- ? JSON.parse(embeddedCitationAttr)
654
- : null,
655
651
  };
656
652
  },
657
653
  },
@@ -155,7 +155,6 @@ export const jatsReferenceParser = {
155
155
  const citation = buildCitation('', rids);
156
156
  modelNodes.push(citation);
157
157
  crossReferenceNode.setAttribute('rid', citation._id);
158
- crossReferenceNode.setAttribute('data-reference-embedded-citation', JSON.stringify(citation.embeddedCitationItems));
159
158
  }
160
159
  else {
161
160
  crossReferenceNode.removeAttribute('rid');
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const bibliographyElement = {
17
- content: '(bibliography_item | placeholder)*',
17
+ content: 'bibliography_item*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  contents: { default: '' },
@@ -23,22 +23,16 @@ export const citation = {
23
23
  contents: { default: '' },
24
24
  selectedText: { default: '' },
25
25
  dataTracked: { default: null },
26
- embeddedCitationItems: { default: null },
27
26
  },
28
27
  parseDOM: [
29
28
  {
30
29
  tag: 'span.citation[data-reference-id]',
31
30
  getAttrs: (p) => {
32
31
  const dom = p;
33
- const attr = {
32
+ return {
34
33
  rid: dom.getAttribute('data-reference-id'),
35
34
  contents: dom.innerHTML,
36
35
  };
37
- const embeddedCitationAttr = dom.getAttribute('data-reference-embedded-citation');
38
- if (embeddedCitationAttr) {
39
- attr['embeddedCitationItems'] = JSON.parse(embeddedCitationAttr);
40
- }
41
- return attr;
42
36
  },
43
37
  },
44
38
  ],
@@ -47,9 +41,6 @@ export const citation = {
47
41
  const dom = document.createElement('span');
48
42
  dom.className = 'citation';
49
43
  dom.setAttribute('data-reference-id', citationNode.attrs.rid);
50
- if (citationNode.attrs.embeddedCitationItems) {
51
- dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
52
- }
53
44
  dom.innerHTML = citationNode.attrs.contents;
54
45
  return dom;
55
46
  },
@@ -130,9 +130,6 @@ export class Decoder {
130
130
  return references.push(this.decode(referenceModel));
131
131
  }
132
132
  });
133
- if (!references.length) {
134
- references.push(schema.nodes.placeholder.createAndFill());
135
- }
136
133
  return schema.nodes.bibliography_element.createChecked({
137
134
  id: model._id,
138
135
  contents: '',
@@ -59,7 +59,3 @@ export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
59
59
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
60
60
  export const isSectionNodeType = (type) => hasGroup(type, GROUP_SECTION);
61
61
  export const isNodeType = (node, type) => node.type === node.type.schema.nodes[type];
62
- export const isMetaNode = (nodeType) => nodeType === schema.nodes.bibliography_item.name ||
63
- nodeType === schema.nodes.affiliation.name ||
64
- nodeType === schema.nodes.contributor.name ||
65
- nodeType === schema.nodes.manuscript.name;
@@ -18,10 +18,6 @@ import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
19
  rid: string;
20
20
  contents: string;
21
- embeddedCitationItems: {
22
- id: string;
23
- bibliographyItem: string;
24
- }[];
25
21
  }
26
22
  export interface CitationNode extends ManuscriptNode {
27
23
  attrs: Attrs;
@@ -20,4 +20,3 @@ export declare const isExecutableNodeType: (type: ManuscriptNodeType) => boolean
20
20
  export declare const isElementNodeType: (type: ManuscriptNodeType) => boolean;
21
21
  export declare const isSectionNodeType: (type: ManuscriptNodeType) => boolean;
22
22
  export declare const isNodeType: <T extends import("prosemirror-model").Node>(node: ManuscriptNode, type: Nodes) => node is T;
23
- export declare const isMetaNode: (nodeType: string) => boolean;
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.4.1-LEAN-2737",
4
+ "version": "1.4.1-LIT-537312-2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -82,4 +82,4 @@
82
82
  "prosemirror-state": "^1.4.2",
83
83
  "prosemirror-view": "^1.29.1"
84
84
  }
85
- }
85
+ }