jats-cli 1.0.14 → 1.0.15

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.
package/dist/jats.cjs CHANGED
@@ -48999,7 +48999,7 @@ var {
48999
48999
  } = import_index.default;
49000
49000
 
49001
49001
  // src/version.ts
49002
- var version = "1.0.14";
49002
+ var version = "1.0.15";
49003
49003
  var version_default = version;
49004
49004
 
49005
49005
  // src/parse.ts
@@ -65573,7 +65573,7 @@ function journalTransforms(body) {
65573
65573
  }
65574
65574
 
65575
65575
  // ../jats-convert/dist/version.js
65576
- var version3 = "1.0.14";
65576
+ var version3 = "1.0.15";
65577
65577
  var version_default3 = version3;
65578
65578
 
65579
65579
  // ../jats-convert/dist/myst/inlineCitations.js
@@ -65863,6 +65863,20 @@ function abbreviationsFromText(text) {
65863
65863
  }
65864
65864
 
65865
65865
  // ../jats-convert/dist/index.js
65866
+ var MEDIA_FIGURE_EXTENSIONS = [
65867
+ ".png",
65868
+ ".jpg",
65869
+ ".jpeg",
65870
+ ".svg",
65871
+ ".gif",
65872
+ ".tiff",
65873
+ ".tif",
65874
+ ".eps",
65875
+ ".webp",
65876
+ ".mp4",
65877
+ ".mov",
65878
+ ".avi"
65879
+ ];
65866
65880
  function refTypeToReferenceKind(kind) {
65867
65881
  switch (kind) {
65868
65882
  case RefType.sec:
@@ -66241,14 +66255,49 @@ var handlers = {
66241
66255
  }
66242
66256
  },
66243
66257
  ["supplementary-material"](node, state2) {
66244
- var _a;
66245
- if (node.id) {
66246
- const { label, identifier } = (_a = normalizeLabel(node.id)) !== null && _a !== void 0 ? _a : {};
66247
- state2.openNode("div", { label, identifier });
66248
- }
66249
- state2.renderChildren(node);
66250
- if (node.id) {
66258
+ var _a, _b, _c, _d, _e;
66259
+ const { label, identifier } = (_a = normalizeLabel(node.id)) !== null && _a !== void 0 ? _a : {};
66260
+ let maybeCaption;
66261
+ let media;
66262
+ if (((_b = node.children) === null || _b === void 0 ? void 0 : _b.length) === 1 && node.children[0].type === "media") {
66263
+ media = node.children[0];
66264
+ } else if (((_c = node.children) === null || _c === void 0 ? void 0 : _c.length) === 2 && node.children[0].type === "label" && node.children[1].type === "media") {
66265
+ maybeCaption = node.children[0];
66266
+ media = node.children[1];
66267
+ }
66268
+ const url = media === null || media === void 0 ? void 0 : media["xlink:href"];
66269
+ let caption = (_d = select3("caption", media)) !== null && _d !== void 0 ? _d : maybeCaption;
66270
+ if (((_e = caption === null || caption === void 0 ? void 0 : caption.children) === null || _e === void 0 ? void 0 : _e.length) === 1 && caption.children[0].type === "p") {
66271
+ caption = caption.children[0];
66272
+ }
66273
+ if (url && MEDIA_FIGURE_EXTENSIONS.find((ext) => url.endsWith(ext))) {
66274
+ const title = select3("title", media);
66275
+ state2.openNode("container", { label, identifier, kind: "figure" });
66276
+ const wasInContainer = state2.data.isInContainer;
66277
+ state2.data.isInContainer = true;
66278
+ state2.addLeaf("image", { url });
66279
+ state2.openNode("caption");
66280
+ state2.openNode("link", { url });
66281
+ if (title) {
66282
+ state2.openNode("strong");
66283
+ state2.renderChildren(title);
66284
+ state2.closeNode();
66285
+ }
66286
+ if (caption) {
66287
+ state2.renderChildren(caption);
66288
+ }
66289
+ state2.closeNode();
66290
+ state2.closeNode();
66251
66291
  state2.closeNode();
66292
+ state2.data.isInContainer = wasInContainer;
66293
+ } else {
66294
+ if (node.id) {
66295
+ state2.openNode("div", { label, identifier });
66296
+ }
66297
+ state2.renderChildren(node);
66298
+ if (node.id) {
66299
+ state2.closeNode();
66300
+ }
66252
66301
  }
66253
66302
  },
66254
66303
  ["app-group"](node, state2) {
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const version = "1.0.14";
1
+ declare const version = "1.0.15";
2
2
  export default version;
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- const version = '1.0.14';
1
+ const version = '1.0.15';
2
2
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jats-cli",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Typescript CLI for with JATS",
5
5
  "author": "Rowan Cockett <rowan@continuous.foundation>",
6
6
  "homepage": "https://github.com/continuous-foundation/jats",
@@ -45,11 +45,11 @@
45
45
  "dependencies": {
46
46
  "doi-utils": "^2.0.0",
47
47
  "fair-principles": "^2.0.0",
48
- "jats-convert": "^1.0.14",
49
- "jats-fetch": "^1.0.14",
50
- "jats-tags": "^1.0.14",
51
- "jats-utils": "^1.0.14",
52
- "jats-xml": "^1.0.14",
48
+ "jats-convert": "^1.0.15",
49
+ "jats-fetch": "^1.0.15",
50
+ "jats-tags": "^1.0.15",
51
+ "jats-utils": "^1.0.15",
52
+ "jats-xml": "^1.0.15",
53
53
  "js-yaml": "^4.1.0",
54
54
  "unist-util-is": "^5.2.1",
55
55
  "unist-util-select": "^4.0.0"