@manuscripts/transform 4.3.10 → 4.3.12

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.
@@ -135,18 +135,14 @@ const wrappers = {
135
135
  issue: (str) => `<issue>${str}</issue>`,
136
136
  supplement: (str) => `<supplement>${str}</supplement>`,
137
137
  page: (str) => {
138
- let fpage = str;
139
- let lpage;
140
- const parts = str.split('-');
141
- if (parts.length === 2) {
142
- fpage = parts[0];
143
- lpage = parts[1];
138
+ const parts = str.split(/([-–])/);
139
+ if (parts.length === 3) {
140
+ const fpage = parts[0].trim();
141
+ const separator = parts[1].trim();
142
+ const lpage = parts[2].trim();
143
+ return `<fpage>${fpage}</fpage>${separator}<lpage>${lpage}</lpage>`;
144
144
  }
145
- str = str.replace(fpage, `<fpage>${fpage}</fpage>`);
146
- if (lpage) {
147
- str = str.replace(lpage, `<lpage>${lpage}</lpage>`);
148
- }
149
- return str;
145
+ return `<fpage>${str.trim()}</fpage>`;
150
146
  },
151
147
  title: (str, item) => {
152
148
  const type = item.type;
@@ -1413,8 +1413,7 @@ class JATSExporter {
1413
1413
  footNote.setAttribute('fn-type', fnType);
1414
1414
  const title = section.querySelector('title');
1415
1415
  if (title) {
1416
- const footNoteTitle = this.createElement('p');
1417
- footNoteTitle.setAttribute('content-type', 'fn-title');
1416
+ const footNoteTitle = this.createElement('label');
1418
1417
  footNoteTitle.textContent = title.textContent;
1419
1418
  section.removeChild(title);
1420
1419
  footNote.append(footNoteTitle);
@@ -187,7 +187,8 @@ const moveSpecialFootnotes = (doc, group, sectionCategories, createElement) => {
187
187
  const category = sectionCategories.find((category) => category.synonyms.includes(type));
188
188
  if (category) {
189
189
  const section = createElement('sec');
190
- const fnTitle = fn.querySelector('p[content-type="fn-title"]');
190
+ const fnTitle = fn.querySelector('label') ||
191
+ fn.querySelector('p[content-type="fn-title"]');
191
192
  if (fnTitle) {
192
193
  const title = createElement('title');
193
194
  const titleText = fnTitle.textContent?.trim();
@@ -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 = "4.3.10";
4
+ exports.VERSION = "4.3.12";
@@ -128,18 +128,14 @@ const wrappers = {
128
128
  issue: (str) => `<issue>${str}</issue>`,
129
129
  supplement: (str) => `<supplement>${str}</supplement>`,
130
130
  page: (str) => {
131
- let fpage = str;
132
- let lpage;
133
- const parts = str.split('-');
134
- if (parts.length === 2) {
135
- fpage = parts[0];
136
- lpage = parts[1];
131
+ const parts = str.split(/([-–])/);
132
+ if (parts.length === 3) {
133
+ const fpage = parts[0].trim();
134
+ const separator = parts[1].trim();
135
+ const lpage = parts[2].trim();
136
+ return `<fpage>${fpage}</fpage>${separator}<lpage>${lpage}</lpage>`;
137
137
  }
138
- str = str.replace(fpage, `<fpage>${fpage}</fpage>`);
139
- if (lpage) {
140
- str = str.replace(lpage, `<lpage>${lpage}</lpage>`);
141
- }
142
- return str;
138
+ return `<fpage>${str.trim()}</fpage>`;
143
139
  },
144
140
  title: (str, item) => {
145
141
  const type = item.type;
@@ -1373,8 +1373,7 @@ export class JATSExporter {
1373
1373
  footNote.setAttribute('fn-type', fnType);
1374
1374
  const title = section.querySelector('title');
1375
1375
  if (title) {
1376
- const footNoteTitle = this.createElement('p');
1377
- footNoteTitle.setAttribute('content-type', 'fn-title');
1376
+ const footNoteTitle = this.createElement('label');
1378
1377
  footNoteTitle.textContent = title.textContent;
1379
1378
  section.removeChild(title);
1380
1379
  footNote.append(footNoteTitle);
@@ -172,7 +172,8 @@ const moveSpecialFootnotes = (doc, group, sectionCategories, createElement) => {
172
172
  const category = sectionCategories.find((category) => category.synonyms.includes(type));
173
173
  if (category) {
174
174
  const section = createElement('sec');
175
- const fnTitle = fn.querySelector('p[content-type="fn-title"]');
175
+ const fnTitle = fn.querySelector('label') ||
176
+ fn.querySelector('p[content-type="fn-title"]');
176
177
  if (fnTitle) {
177
178
  const title = createElement('title');
178
179
  const titleText = fnTitle.textContent?.trim();
@@ -1 +1 @@
1
- export const VERSION = "4.3.10";
1
+ export const VERSION = "4.3.12";
@@ -1 +1 @@
1
- export declare const VERSION = "4.3.10";
1
+ export declare const VERSION = "4.3.12";
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": "4.3.10",
4
+ "version": "4.3.12",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",