@manuscripts/transform 2.1.7-LEAN-3467-0 → 2.1.7-LEAN-3321

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,20 +202,34 @@ exports.jatsBodyTransformations = {
202
202
  }
203
203
  },
204
204
  moveFootnotes(doc, group, createElement) {
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')) {
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) {
211
214
  containingGroup.appendChild(footnote);
212
215
  }
213
- });
216
+ }
214
217
  if (!footnotesSection && containingGroup.innerHTML) {
215
- footnotesSection = this.createFootnotesSection([containingGroup], createElement);
218
+ const section = this.createFootnotesSection([containingGroup], createElement);
219
+ group.append(section);
216
220
  }
217
- if (footnotesSection) {
218
- group.insertBefore(footnotesSection, ((_a = group.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling) || group.firstChild);
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);
219
233
  }
220
234
  },
221
235
  moveCaptionsToEnd(body) {
@@ -19,7 +19,6 @@ exports.tableCol = exports.tableColGroup = void 0;
19
19
  exports.tableColGroup = {
20
20
  content: 'table_col+',
21
21
  group: 'block',
22
- tableRole: 'colgroup',
23
22
  parseDOM: [
24
23
  {
25
24
  tag: 'colgroup',
@@ -34,7 +33,6 @@ exports.tableCol = {
34
33
  width: { default: '' },
35
34
  },
36
35
  group: 'block',
37
- tableRole: 'col',
38
36
  parseDOM: [
39
37
  {
40
38
  tag: 'col',
@@ -19,8 +19,9 @@ exports.tableElementFooter = void 0;
19
19
  exports.tableElementFooter = {
20
20
  attrs: {
21
21
  id: { default: '' },
22
+ dataTracked: { default: null }
22
23
  },
23
- content: '(paragraph | footnotes_element)+',
24
+ content: '(paragraph | footnotes_element)*',
24
25
  group: 'block element',
25
26
  toDOM: () => ['table-wrap-foot', 0],
26
27
  };
@@ -199,20 +199,34 @@ export const jatsBodyTransformations = {
199
199
  }
200
200
  },
201
201
  moveFootnotes(doc, group, createElement) {
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')) {
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) {
208
211
  containingGroup.appendChild(footnote);
209
212
  }
210
- });
213
+ }
211
214
  if (!footnotesSection && containingGroup.innerHTML) {
212
- footnotesSection = this.createFootnotesSection([containingGroup], createElement);
215
+ const section = this.createFootnotesSection([containingGroup], createElement);
216
+ group.append(section);
213
217
  }
214
- if (footnotesSection) {
215
- group.insertBefore(footnotesSection, ((_a = group.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling) || group.firstChild);
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);
216
230
  }
217
231
  },
218
232
  moveCaptionsToEnd(body) {
@@ -16,7 +16,6 @@
16
16
  export const tableColGroup = {
17
17
  content: 'table_col+',
18
18
  group: 'block',
19
- tableRole: 'colgroup',
20
19
  parseDOM: [
21
20
  {
22
21
  tag: 'colgroup',
@@ -31,7 +30,6 @@ export const tableCol = {
31
30
  width: { default: '' },
32
31
  },
33
32
  group: 'block',
34
- tableRole: 'col',
35
33
  parseDOM: [
36
34
  {
37
35
  tag: 'col',
@@ -16,8 +16,9 @@
16
16
  export const tableElementFooter = {
17
17
  attrs: {
18
18
  id: { default: '' },
19
+ dataTracked: { default: null }
19
20
  },
20
- content: '(paragraph | footnotes_element)+',
21
+ content: '(paragraph | footnotes_element)*',
21
22
  group: 'block element',
22
23
  toDOM: () => ['table-wrap-foot', 0],
23
24
  };
@@ -13,12 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ManuscriptNode, TableNodeSpec } from '../types';
17
- export type TableColGroupNode = ManuscriptNode;
16
+ import { NodeSpec } from 'prosemirror-model';
17
+ import { ManuscriptNode } from '../types';
18
18
  export interface TableColNode extends ManuscriptNode {
19
19
  attrs: {
20
20
  width: string;
21
21
  };
22
22
  }
23
- export declare const tableColGroup: TableNodeSpec;
24
- export declare const tableCol: TableNodeSpec;
23
+ export declare const tableColGroup: NodeSpec;
24
+ export declare const tableCol: 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-LEAN-3467-0",
4
+ "version": "2.1.7-LEAN-3321",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",