@manuscripts/transform 2.1.7 → 2.1.8-LEAN-3423-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.
@@ -202,34 +202,20 @@ exports.jatsBodyTransformations = {
202
202
  }
203
203
  },
204
204
  moveFootnotes(doc, group, createElement) {
205
- const footnotes = [
206
- ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
207
- ];
208
- const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
209
- const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
210
- const containingGroup = footnotesSectionGroup || createElement('fn-group');
211
- for (const footnote of footnotes) {
212
- const type = footnote.getAttribute('fn-type');
213
- if (!type) {
205
+ var _a;
206
+ const footnotes = Array.from(doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'));
207
+ let footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
208
+ const containingGroup = (footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group')) || createElement('fn-group');
209
+ footnotes.forEach((footnote) => {
210
+ if (!footnote.getAttribute('fn-type')) {
214
211
  containingGroup.appendChild(footnote);
215
212
  }
216
- }
213
+ });
217
214
  if (!footnotesSection && containingGroup.innerHTML) {
218
- const section = this.createFootnotesSection([containingGroup], createElement);
219
- group.append(section);
215
+ footnotesSection = this.createFootnotesSection([containingGroup], createElement);
220
216
  }
221
- let regularFootnoteGroups = [
222
- ...doc.querySelectorAll('back > fn-group:not([fn-type])'),
223
- ];
224
- regularFootnoteGroups = regularFootnoteGroups.filter((group) => {
225
- return group.childElementCount === 0
226
- ? false
227
- : !group.querySelector('fn[fn-type]');
228
- });
229
- if (regularFootnoteGroups.length > 0) {
230
- regularFootnoteGroups.map((g) => removeNodeFromParent(g));
231
- const footnotes = this.createFootnotesSection(regularFootnoteGroups, createElement);
232
- group.appendChild(footnotes);
217
+ if (footnotesSection) {
218
+ group.insertBefore(footnotesSection, ((_a = group.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling) || group.firstChild);
233
219
  }
234
220
  },
235
221
  moveCaptionsToEnd(body) {
@@ -620,7 +620,7 @@ class JATSExporter {
620
620
  title: () => '',
621
621
  affiliations: () => '',
622
622
  contributors: () => '',
623
- table_element_footer: () => ['table-wrap-foot', 0],
623
+ table_element_footer: (node) => node.textContent ? ['table-wrap-foot', 0] : '',
624
624
  contributor: () => '',
625
625
  affiliation: () => '',
626
626
  attribution: () => ['attrib', 0],
@@ -25,6 +25,7 @@ exports.bulletList = {
25
25
  id: { default: '' },
26
26
  paragraphStyle: { default: '' },
27
27
  dataTracked: { default: null },
28
+ listStyleType: { default: null },
28
29
  },
29
30
  parseDOM: [
30
31
  {
@@ -33,6 +34,7 @@ exports.bulletList = {
33
34
  const dom = p;
34
35
  return {
35
36
  id: dom.getAttribute('id'),
37
+ listStyleType: dom.getAttribute('list-type'),
36
38
  };
37
39
  },
38
40
  },
@@ -44,6 +46,7 @@ exports.bulletList = {
44
46
  'ul',
45
47
  {
46
48
  id: bulletListNode.attrs.id,
49
+ 'list-type': bulletListNode.attrs.listStyleType,
47
50
  class: (0, attributes_1.buildElementClass)(bulletListNode.attrs),
48
51
  'data-object-type': json_schema_1.ObjectTypes.ListElement,
49
52
  },
@@ -199,34 +199,20 @@ export const jatsBodyTransformations = {
199
199
  }
200
200
  },
201
201
  moveFootnotes(doc, group, createElement) {
202
- const footnotes = [
203
- ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
204
- ];
205
- const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
206
- const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
207
- const containingGroup = footnotesSectionGroup || createElement('fn-group');
208
- for (const footnote of footnotes) {
209
- const type = footnote.getAttribute('fn-type');
210
- if (!type) {
202
+ var _a;
203
+ const footnotes = Array.from(doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'));
204
+ let footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
205
+ const containingGroup = (footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group')) || createElement('fn-group');
206
+ footnotes.forEach((footnote) => {
207
+ if (!footnote.getAttribute('fn-type')) {
211
208
  containingGroup.appendChild(footnote);
212
209
  }
213
- }
210
+ });
214
211
  if (!footnotesSection && containingGroup.innerHTML) {
215
- const section = this.createFootnotesSection([containingGroup], createElement);
216
- group.append(section);
212
+ footnotesSection = this.createFootnotesSection([containingGroup], createElement);
217
213
  }
218
- let regularFootnoteGroups = [
219
- ...doc.querySelectorAll('back > fn-group:not([fn-type])'),
220
- ];
221
- regularFootnoteGroups = regularFootnoteGroups.filter((group) => {
222
- return group.childElementCount === 0
223
- ? false
224
- : !group.querySelector('fn[fn-type]');
225
- });
226
- if (regularFootnoteGroups.length > 0) {
227
- regularFootnoteGroups.map((g) => removeNodeFromParent(g));
228
- const footnotes = this.createFootnotesSection(regularFootnoteGroups, createElement);
229
- group.appendChild(footnotes);
214
+ if (footnotesSection) {
215
+ group.insertBefore(footnotesSection, ((_a = group.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling) || group.firstChild);
230
216
  }
231
217
  },
232
218
  moveCaptionsToEnd(body) {
@@ -612,7 +612,7 @@ export class JATSExporter {
612
612
  title: () => '',
613
613
  affiliations: () => '',
614
614
  contributors: () => '',
615
- table_element_footer: () => ['table-wrap-foot', 0],
615
+ table_element_footer: (node) => node.textContent ? ['table-wrap-foot', 0] : '',
616
616
  contributor: () => '',
617
617
  affiliation: () => '',
618
618
  attribution: () => ['attrib', 0],
@@ -22,6 +22,7 @@ export const bulletList = {
22
22
  id: { default: '' },
23
23
  paragraphStyle: { default: '' },
24
24
  dataTracked: { default: null },
25
+ listStyleType: { default: null },
25
26
  },
26
27
  parseDOM: [
27
28
  {
@@ -30,6 +31,7 @@ export const bulletList = {
30
31
  const dom = p;
31
32
  return {
32
33
  id: dom.getAttribute('id'),
34
+ listStyleType: dom.getAttribute('list-type'),
33
35
  };
34
36
  },
35
37
  },
@@ -41,6 +43,7 @@ export const bulletList = {
41
43
  'ul',
42
44
  {
43
45
  id: bulletListNode.attrs.id,
46
+ 'list-type': bulletListNode.attrs.listStyleType,
44
47
  class: buildElementClass(bulletListNode.attrs),
45
48
  'data-object-type': ObjectTypes.ListElement,
46
49
  },
@@ -19,6 +19,7 @@ export interface BulletListNode extends ManuscriptNode {
19
19
  attrs: {
20
20
  id: string;
21
21
  paragraphStyle: string;
22
+ listStyleType: string;
22
23
  };
23
24
  }
24
25
  export declare const bulletList: NodeSpec;
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": "2.1.7",
4
+ "version": "2.1.8-LEAN-3423-2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,8 +29,8 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "^2.2.6",
33
- "@manuscripts/library": "^1.3.5",
32
+ "@manuscripts/json-schema": "2.2.6-LEAN-3423-0",
33
+ "@manuscripts/library": "1.3.5-LEAN-3423-0",
34
34
  "debug": "^4.3.4",
35
35
  "jszip": "^3.10.1",
36
36
  "mime": "^3.0.0",
@@ -78,4 +78,4 @@
78
78
  "rimraf": "^3.0.2",
79
79
  "typescript": "^4.0.5"
80
80
  }
81
- }
81
+ }