jats-cli 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -94,6 +94,6 @@ As of v1.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39
94
94
  <p style="text-align: center; color: #aaa; padding-top: 50px">
95
95
  Made with love by
96
96
  <a href="https://continuous.foundation" target="_blank" style="color: #aaa">
97
- Continuous Science Foundation <img src="https://continuous.foundation/images/logo-small.svg" style="height: 1em" />
97
+ Continuous Science Foundation <img src="https://cdn.curvenote.com/static/site/csf/icon.svg" style="height: 1em" />
98
98
  </a>
99
99
  </p>
package/dist/jats-test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Command, Option } from 'commander';
2
2
  import { clirun, tic } from 'myst-cli-utils';
3
- import yaml from 'js-yaml';
3
+ import { load, dump } from 'js-yaml';
4
4
  import fs from 'fs';
5
5
  import { select, selectAll } from 'unist-util-select';
6
6
  import { is } from 'unist-util-is';
@@ -9,14 +9,12 @@ import { getSession } from 'jats-xml';
9
9
  import { parseJats } from './parse.js';
10
10
  const INDENT = ' ';
11
11
  function printNodes(expected, received) {
12
- return chalk.reset(`\n${INDENT}${chalk.greenBright('Expected node containing')}:\n${INDENT} ${yaml
13
- .dump(expected)
14
- .replace(/\n/g, `\n${INDENT} `)}\n${INDENT}${chalk.redBright('Received node')}:\n${INDENT} ${yaml.dump(received).replace(/\n/g, `\n${INDENT} `)}`);
12
+ return chalk.reset(`\n${INDENT}${chalk.greenBright('Expected node containing')}:\n${INDENT} ${dump(expected).replace(/\n/g, `\n${INDENT} `)}\n${INDENT}${chalk.redBright('Received node')}:\n${INDENT} ${dump(received).replace(/\n/g, `\n${INDENT} `)}`);
15
13
  }
16
14
  export async function testJatsFile(session, file, opts) {
17
15
  const toc = tic();
18
16
  const jats = await parseJats(session, file);
19
- const tests = yaml.load(fs.readFileSync(opts.cases).toString());
17
+ const tests = load(fs.readFileSync(opts.cases).toString());
20
18
  const results = tests.cases.map((testCase, index) => {
21
19
  if (!testCase.title) {
22
20
  return [`Test Case ${index}`, null, 'Test must include a title'];
package/dist/jats.cjs CHANGED
@@ -33957,7 +33957,7 @@ var require_dist_cjs71 = __commonJS({
33957
33957
  Tier: () => Tier,
33958
33958
  TransitionDefaultMinimumObjectSize: () => TransitionDefaultMinimumObjectSize,
33959
33959
  TransitionStorageClass: () => TransitionStorageClass,
33960
- Type: () => Type2,
33960
+ Type: () => Type,
33961
33961
  UploadPartCommand: () => UploadPartCommand,
33962
33962
  UploadPartCopyCommand: () => UploadPartCopyCommand,
33963
33963
  UploadPartCopyOutputFilterSensitiveLog: () => UploadPartCopyOutputFilterSensitiveLog,
@@ -34060,7 +34060,7 @@ var require_dist_cjs71 = __commonJS({
34060
34060
  Enabled: "Enabled",
34061
34061
  Suspended: "Suspended"
34062
34062
  };
34063
- var Type2 = {
34063
+ var Type = {
34064
34064
  AmazonCustomerByEmail: "AmazonCustomerByEmail",
34065
34065
  CanonicalUser: "CanonicalUser",
34066
34066
  Group: "Group"
@@ -48999,7 +48999,7 @@ var {
48999
48999
  } = import_index.default;
49000
49000
 
49001
49001
  // src/version.ts
49002
- var version = "1.1.0";
49002
+ var version = "1.1.1";
49003
49003
  var version_default = version;
49004
49004
 
49005
49005
  // src/parse.ts
@@ -55916,11 +55916,14 @@ var RuleId;
55916
55916
  })(RuleId || (RuleId = {}));
55917
55917
 
55918
55918
  // ../jats-utils/dist/utils.js
55919
- function convertToUnist(node) {
55919
+ function convertToUnist(node, ctx) {
55920
+ var _a;
55921
+ const insidePreformat = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.insidePreformat) !== null && _a !== void 0 ? _a : false;
55920
55922
  switch (node.type) {
55921
55923
  case "element": {
55922
55924
  const { name: name2, attributes, elements } = node;
55923
- const children = elements === null || elements === void 0 ? void 0 : elements.map(convertToUnist).filter((n) => !!n);
55925
+ const nextInside = insidePreformat || name2 === "preformat";
55926
+ const children = elements === null || elements === void 0 ? void 0 : elements.map((el) => convertToUnist(el, { insidePreformat: nextInside })).filter((n) => !!n);
55924
55927
  const { type: type2, ...attrs } = attributes !== null && attributes !== void 0 ? attributes : {};
55925
55928
  if (type2 !== void 0)
55926
55929
  attrs._type = type2;
@@ -55933,18 +55936,24 @@ function convertToUnist(node) {
55933
55936
  }
55934
55937
  case "text": {
55935
55938
  const { attributes, text } = node;
55939
+ const raw = String(text);
55940
+ if (!insidePreformat && !raw.trim()) {
55941
+ return void 0;
55942
+ }
55943
+ const value = insidePreformat ? raw : raw.replace(/\n(\s+)$/, "");
55936
55944
  return {
55937
55945
  type: "text",
55938
55946
  ...attributes,
55939
- value: String(text).replace(/\n(\s+)$/, "")
55947
+ value
55940
55948
  };
55941
55949
  }
55942
55950
  case "cdata": {
55943
55951
  const { attributes, cdata } = node;
55952
+ const str2 = String(cdata);
55944
55953
  return {
55945
55954
  type: "cdata",
55946
55955
  ...attributes,
55947
- cdata: String(cdata).trim()
55956
+ cdata: insidePreformat ? str2 : str2.trim()
55948
55957
  };
55949
55958
  }
55950
55959
  case "comment": {
@@ -58720,10 +58729,29 @@ var tableWrapOrder = order([
58720
58729
 
58721
58730
  // ../jats-xml/dist/jats.js
58722
58731
  function select2(selector, node) {
58723
- var _a;
58724
- return (_a = select(selector, node)) !== null && _a !== void 0 ? _a : void 0;
58732
+ var _a, _b;
58733
+ try {
58734
+ return (_a = select(selector, node)) !== null && _a !== void 0 ? _a : void 0;
58735
+ } catch (error) {
58736
+ const nodeType = (_b = node === null || node === void 0 ? void 0 : node.type) !== null && _b !== void 0 ? _b : "(undefined)";
58737
+ const msg = error instanceof Error ? error.message : String(error);
58738
+ throw new Error(`[jats-xml/select] selector="${selector}" nodeType="${nodeType}" failed: ${msg}`);
58739
+ }
58725
58740
  }
58726
58741
  var DEFAULT_DOCTYPE = 'article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD with MathML3 v1.3 20210610//EN" "http://jats.nlm.nih.gov/publishing/1.3/JATS-archivearticle1-3-mathml3.dtd"';
58742
+ function significantChildElements(elements) {
58743
+ return elements === null || elements === void 0 ? void 0 : elements.filter((elem) => {
58744
+ var _a;
58745
+ if (elem.type === "comment")
58746
+ return false;
58747
+ if (elem.type === "text") {
58748
+ const t2 = String((_a = elem.text) !== null && _a !== void 0 ? _a : "");
58749
+ if (!t2.trim())
58750
+ return false;
58751
+ }
58752
+ return true;
58753
+ });
58754
+ }
58727
58755
  var Jats = class {
58728
58756
  constructor(data, opts) {
58729
58757
  var _a, _b;
@@ -58732,13 +58760,18 @@ var Jats = class {
58732
58760
  if (opts === null || opts === void 0 ? void 0 : opts.source)
58733
58761
  this.source = opts.source;
58734
58762
  try {
58735
- this.raw = (0, import_xml_js3.xml2js)(data, { compact: false });
58763
+ this.raw = (0, import_xml_js3.xml2js)(data, {
58764
+ compact: false,
58765
+ // Preserve whitespace-only text nodes between elements. This is usually unnecessary except inside <preformat>.
58766
+ // convertToUnist drops these outside preformat so other content is processed independent of arbitrary xml whitespace.
58767
+ captureSpacesBetweenElements: true
58768
+ });
58736
58769
  } catch (error) {
58737
58770
  throw new Error("Problem parsing the JATS document, please ensure it is XML");
58738
58771
  }
58739
58772
  const { declaration, elements } = this.raw;
58740
58773
  this.declaration = declaration === null || declaration === void 0 ? void 0 : declaration.attributes;
58741
- const filteredElements = elements === null || elements === void 0 ? void 0 : elements.filter((elem) => elem.type !== "comment");
58774
+ const filteredElements = significantChildElements(elements);
58742
58775
  if ((filteredElements === null || filteredElements === void 0 ? void 0 : filteredElements.length) && filteredElements[0].type !== "doctype") {
58743
58776
  (_a = this.log) === null || _a === void 0 ? void 0 : _a.warn("JATS is missing DOCTYPE declaration");
58744
58777
  filteredElements.unshift({ type: "doctype" });
@@ -58752,42 +58785,43 @@ var Jats = class {
58752
58785
  (_b = this.log) === null || _b === void 0 ? void 0 : _b.debug(toc("Parsed and converted JATS to unist tree in %s"));
58753
58786
  }
58754
58787
  get frontmatter() {
58755
- var _a, _b, _c, _d, _e, _f, _g, _h;
58788
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
58756
58789
  const title = this.articleTitle;
58757
58790
  const subtitle = this.articleSubtitle;
58758
58791
  const short_title = this.articleAltTitle;
58759
58792
  let date;
58760
- if (this.publicationDate) {
58761
- const pubDate = toDate(this.publicationDate);
58762
- if (pubDate) {
58763
- const year = pubDate.getFullYear();
58764
- const month = (pubDate.getMonth() + 1).toString().padStart(2, "0");
58765
- const day = pubDate.getDate().toString().padStart(2, "0");
58793
+ const preferredDateNode = (_c = (_b = (_a = this.publicationDate) !== null && _a !== void 0 ? _a : this.pubHistoryPubDate) !== null && _b !== void 0 ? _b : this.pubHistoryAcceptedDate) !== null && _c !== void 0 ? _c : this.historyAcceptedDate;
58794
+ if (preferredDateNode) {
58795
+ const d = toDate(preferredDateNode);
58796
+ if (d) {
58797
+ const year = d.getUTCFullYear();
58798
+ const month = (d.getUTCMonth() + 1).toString().padStart(2, "0");
58799
+ const day = d.getUTCDate().toString().padStart(2, "0");
58766
58800
  date = `${year}-${month}-${day}`;
58767
58801
  }
58768
58802
  }
58769
- const authors = (_a = this.articleAuthors) === null || _a === void 0 ? void 0 : _a.map((auth) => {
58803
+ const authors = (_d = this.articleAuthors) === null || _d === void 0 ? void 0 : _d.map((auth) => {
58770
58804
  return processContributor(auth);
58771
58805
  });
58772
- const affiliations = (_b = this.articleAffiliations) === null || _b === void 0 ? void 0 : _b.map((aff) => {
58806
+ const affiliations = (_e = this.articleAffiliations) === null || _e === void 0 ? void 0 : _e.map((aff) => {
58773
58807
  return processAffiliation(aff);
58774
58808
  });
58775
- const keywords = (_d = (_c = this.keywords) === null || _c === void 0 ? void 0 : _c.map((k) => toText(k))) !== null && _d !== void 0 ? _d : [];
58776
- const firstSubject = select2(Tags.subject, (_e = this.articleCategories) !== null && _e !== void 0 ? _e : this.front);
58809
+ const keywords = (_g = (_f = this.keywords) === null || _f === void 0 ? void 0 : _f.map((k) => toText(k))) !== null && _g !== void 0 ? _g : [];
58810
+ const firstSubject = select2(Tags.subject, (_h = this.articleCategories) !== null && _h !== void 0 ? _h : this.front);
58777
58811
  const journalTitle = select2(Tags.journalTitle, this.front);
58778
58812
  const license = this.license;
58779
58813
  let licenseString = null;
58780
58814
  if (license === null || license === void 0 ? void 0 : license["xlink:href"]) {
58781
58815
  licenseString = license["xlink:href"];
58782
- } else if (select2("[type=ali:license_ref]", license)) {
58783
- licenseString = toText(select2("[type=ali:license_ref]", license));
58816
+ } else if (license && select2("[type=ali\\:license_ref]", license)) {
58817
+ licenseString = toText(select2("[type=ali\\:license_ref]", license));
58784
58818
  } else if (selectAll("ext-link", license).length === 1) {
58785
- licenseString = (_f = select2("ext-link", license)["xlink:href"]) !== null && _f !== void 0 ? _f : null;
58819
+ licenseString = (_j = select2("ext-link", license)["xlink:href"]) !== null && _j !== void 0 ? _j : null;
58786
58820
  } else if (license) {
58787
58821
  licenseString = toText(license);
58788
58822
  }
58789
58823
  let openAccess;
58790
- const licenseType = (_g = license === null || license === void 0 ? void 0 : license["license-type"]) === null || _g === void 0 ? void 0 : _g.toLowerCase();
58824
+ const licenseType = (_k = license === null || license === void 0 ? void 0 : license["license-type"]) === null || _k === void 0 ? void 0 : _k.toLowerCase();
58791
58825
  if (licenseType && ["openaccess", "open-access"].includes(licenseType)) {
58792
58826
  openAccess = true;
58793
58827
  } else if (licenseString === null || licenseString === void 0 ? void 0 : licenseString.match(/^\s*Open Access\s*This/)) {
@@ -58802,7 +58836,7 @@ var Jats = class {
58802
58836
  title: title ? toText(title) : void 0,
58803
58837
  subtitle: subtitle ? toText(subtitle) : void 0,
58804
58838
  short_title: short_title ? toText(short_title) : void 0,
58805
- doi: (_h = this.doi) !== null && _h !== void 0 ? _h : void 0,
58839
+ doi: (_l = this.doi) !== null && _l !== void 0 ? _l : void 0,
58806
58840
  identifiers,
58807
58841
  date,
58808
58842
  authors: authors.length ? authors : void 0,
@@ -58842,6 +58876,49 @@ var Jats = class {
58842
58876
  get publicationDate() {
58843
58877
  return this.publicationDates.find((d) => !!select2(Tags.day, d));
58844
58878
  }
58879
+ /**
58880
+ * JATS `<history>` can include multiple `<date date-type="...">` nodes,
58881
+ * often including an "accepted" date that is a better default for project/page `date`.
58882
+ */
58883
+ get historyDates() {
58884
+ var _a;
58885
+ return selectAll("history date", (_a = this.articleMeta) !== null && _a !== void 0 ? _a : this.front);
58886
+ }
58887
+ get historyAcceptedDate() {
58888
+ const accepted = this.historyDates.find((d) => {
58889
+ var _a;
58890
+ const dt = String((_a = d["date-type"]) !== null && _a !== void 0 ? _a : "").toLowerCase();
58891
+ return dt === "accepted" || dt === "accept";
58892
+ });
58893
+ if (accepted && select2(Tags.day, accepted))
58894
+ return accepted;
58895
+ return void 0;
58896
+ }
58897
+ /**
58898
+ * Some sources store important dates under:
58899
+ * `<article-meta><pub-history><event><date date-type="...">...</date></event></pub-history>`.
58900
+ */
58901
+ get pubHistoryDates() {
58902
+ var _a;
58903
+ return selectAll("pub-history event date", (_a = this.articleMeta) !== null && _a !== void 0 ? _a : this.front);
58904
+ }
58905
+ findPubHistoryDateByType(types3) {
58906
+ const wanted = new Set(types3.map((t2) => t2.toLowerCase()));
58907
+ const found = this.pubHistoryDates.find((d) => {
58908
+ var _a;
58909
+ const dt = String((_a = d["date-type"]) !== null && _a !== void 0 ? _a : "").toLowerCase();
58910
+ return wanted.has(dt);
58911
+ });
58912
+ if (found && select2(Tags.day, found))
58913
+ return found;
58914
+ return void 0;
58915
+ }
58916
+ get pubHistoryPubDate() {
58917
+ return this.findPubHistoryDateByType(["pub", "published", "publication"]);
58918
+ }
58919
+ get pubHistoryAcceptedDate() {
58920
+ return this.findPubHistoryDateByType(["accepted", "accept"]);
58921
+ }
58845
58922
  get license() {
58846
58923
  return select2(Tags.license, this.permissions);
58847
58924
  }
@@ -58905,11 +58982,19 @@ var Jats = class {
58905
58982
  get subArticles() {
58906
58983
  return selectAll(Tags.subArticle, this.tree);
58907
58984
  }
58985
+ /** First `ref-list` in back matter. */
58908
58986
  get refList() {
58909
- return select2(Tags.refList, this.back);
58987
+ return this.refLists[0];
58910
58988
  }
58989
+ /** All `ref-list` elements under `back`, in document order. */
58990
+ get refLists() {
58991
+ if (!this.back)
58992
+ return [];
58993
+ return selectAll(Tags.refList, this.back);
58994
+ }
58995
+ /** Every `ref` from every `ref-list` under `back`, in document order. */
58911
58996
  get references() {
58912
- return selectAll(Tags.ref, this.refList);
58997
+ return this.refLists.flatMap((list) => selectAll(Tags.ref, list));
58913
58998
  }
58914
58999
  sort() {
58915
59000
  var _a;
@@ -58943,12 +59028,12 @@ var Jats = class {
58943
59028
  }
58944
59029
  };
58945
59030
  function hasSingleArticle(element) {
58946
- var _a;
58947
59031
  if (element.name === "article") {
58948
59032
  return true;
58949
59033
  }
58950
- if (element.name === "pmc-articleset" && ((_a = element.elements) === null || _a === void 0 ? void 0 : _a.length) === 1 && element.elements[0].name === "article") {
58951
- return true;
59034
+ if (element.name === "pmc-articleset") {
59035
+ const children = significantChildElements(element.elements);
59036
+ return (children === null || children === void 0 ? void 0 : children.length) === 1 && children[0].name === "article";
58952
59037
  }
58953
59038
  return false;
58954
59039
  }
@@ -62513,51 +62598,12 @@ function renamed(from, to) {
62513
62598
  throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
62514
62599
  };
62515
62600
  }
62516
- var Type = type;
62517
- var Schema = schema;
62518
- var FAILSAFE_SCHEMA = failsafe;
62519
- var JSON_SCHEMA = json;
62520
- var CORE_SCHEMA = core;
62521
- var DEFAULT_SCHEMA = _default;
62522
62601
  var load = loader.load;
62523
62602
  var loadAll = loader.loadAll;
62524
62603
  var dump = dumper.dump;
62525
- var YAMLException = exception;
62526
- var types3 = {
62527
- binary,
62528
- float,
62529
- map,
62530
- null: _null,
62531
- pairs,
62532
- set,
62533
- timestamp,
62534
- bool,
62535
- int,
62536
- merge,
62537
- omap,
62538
- seq,
62539
- str
62540
- };
62541
62604
  var safeLoad = renamed("safeLoad", "load");
62542
62605
  var safeLoadAll = renamed("safeLoadAll", "loadAll");
62543
62606
  var safeDump = renamed("safeDump", "dump");
62544
- var jsYaml = {
62545
- Type,
62546
- Schema,
62547
- FAILSAFE_SCHEMA,
62548
- JSON_SCHEMA,
62549
- CORE_SCHEMA,
62550
- DEFAULT_SCHEMA,
62551
- load,
62552
- loadAll,
62553
- dump,
62554
- YAMLException,
62555
- types: types3,
62556
- safeLoad,
62557
- safeLoadAll,
62558
- safeDump
62559
- };
62560
- var js_yaml_default = jsYaml;
62561
62607
 
62562
62608
  // src/jats-test.ts
62563
62609
  var import_fs3 = __toESM(require("fs"), 1);
@@ -62566,19 +62612,21 @@ function printNodes(expected, received) {
62566
62612
  return source_default2.reset(
62567
62613
  `
62568
62614
  ${INDENT}${source_default2.greenBright("Expected node containing")}:
62569
- ${INDENT} ${js_yaml_default.dump(expected).replace(/\n/g, `
62615
+ ${INDENT} ${dump(
62616
+ expected
62617
+ ).replace(/\n/g, `
62570
62618
  ${INDENT} `)}
62571
62619
  ${INDENT}${source_default2.redBright(
62572
62620
  "Received node"
62573
62621
  )}:
62574
- ${INDENT} ${js_yaml_default.dump(received).replace(/\n/g, `
62622
+ ${INDENT} ${dump(received).replace(/\n/g, `
62575
62623
  ${INDENT} `)}`
62576
62624
  );
62577
62625
  }
62578
62626
  async function testJatsFile(session, file, opts) {
62579
62627
  const toc = tic();
62580
62628
  const jats = await parseJats(session, file);
62581
- const tests = js_yaml_default.load(import_fs3.default.readFileSync(opts.cases).toString());
62629
+ const tests = load(import_fs3.default.readFileSync(opts.cases).toString());
62582
62630
  const results = tests.cases.map((testCase, index2) => {
62583
62631
  if (!testCase.title) {
62584
62632
  return [`Test Case ${index2}`, null, "Test must include a title"];
@@ -63537,7 +63585,7 @@ var defaultPseudoSignature = {
63537
63585
  type: "String",
63538
63586
  optional: true
63539
63587
  };
63540
- function calculatePseudoSignature(types4) {
63588
+ function calculatePseudoSignature(types3) {
63541
63589
  var result = {
63542
63590
  type: "NoArgument",
63543
63591
  optional: false
@@ -63548,7 +63596,7 @@ function calculatePseudoSignature(types4) {
63548
63596
  }
63549
63597
  result.type = type3;
63550
63598
  }
63551
- for (var _i = 0, types_1 = types4; _i < types_1.length; _i++) {
63599
+ for (var _i = 0, types_1 = types3; _i < types_1.length; _i++) {
63552
63600
  var type2 = types_1[_i];
63553
63601
  if (type2 === "NoArgument") {
63554
63602
  result.optional = true;
@@ -64980,18 +65028,20 @@ var import_xml_js4 = __toESM(require_lib2(), 1);
64980
65028
 
64981
65029
  // ../jats-convert/dist/transforms/admonitions.js
64982
65030
  function admonitionTransform(tree, file) {
64983
- const captions = selectAll2(`${Tags.boxedText} > ${Tags.caption}`, tree);
64984
- captions.forEach((caption) => {
64985
- const title = select3(Tags.title, caption);
65031
+ const boxedTexts = selectAll2(Tags.boxedText, tree);
65032
+ boxedTexts.forEach((boxedText) => {
65033
+ const caption = select3(`${Tags.caption}`, boxedText);
65034
+ const title = caption ? select3(Tags.title, caption) : select3(Tags.title, boxedText);
64986
65035
  if (!title) {
64987
65036
  fileWarn(file, "Encountered boxed-text without title", {
64988
- node: caption,
65037
+ node: boxedText,
64989
65038
  ruleId: RuleId.jatsParses
64990
65039
  });
64991
- return;
65040
+ } else {
65041
+ const nodeToReplace = caption !== null && caption !== void 0 ? caption : title;
65042
+ nodeToReplace.type = "admonitionTitle";
65043
+ nodeToReplace.children = title.children;
64992
65044
  }
64993
- caption.type = "admonitionTitle";
64994
- caption.children = title.children;
64995
65045
  });
64996
65046
  const noCaptions = selectAll2(`${Tags.boxedText} > ${Tags.caption}`, tree);
64997
65047
  noCaptions.forEach((caption) => {
@@ -65004,6 +65054,20 @@ function admonitionTransform(tree, file) {
65004
65054
  function toText2(node) {
65005
65055
  return toText(node);
65006
65056
  }
65057
+ function toTextPreserveWhitespace(node) {
65058
+ if (!node)
65059
+ return "";
65060
+ if (typeof node === "string")
65061
+ return node;
65062
+ if (typeof node.value === "string")
65063
+ return node.value;
65064
+ if (typeof node.cdata === "string")
65065
+ return node.cdata;
65066
+ const children = node.children;
65067
+ if (!children || children.length === 0)
65068
+ return "";
65069
+ return children.map((child) => toTextPreserveWhitespace(child)).join("");
65070
+ }
65007
65071
  function copyNode2(node) {
65008
65072
  return copyNode(node);
65009
65073
  }
@@ -65725,7 +65789,7 @@ function journalTransforms(fullTree, body) {
65725
65789
  }
65726
65790
 
65727
65791
  // ../jats-convert/dist/version.js
65728
- var version3 = "1.1.0";
65792
+ var version3 = "1.1.1";
65729
65793
  var version_default3 = version3;
65730
65794
 
65731
65795
  // ../jats-convert/dist/myst/inlineCitations.js
@@ -65959,6 +66023,14 @@ function abbreviationsFromTree(tree, frontmatter) {
65959
66023
  function maybeStopWord(word) {
65960
66024
  return word.length < 5;
65961
66025
  }
66026
+ function isQuotedParentheticalLabel(abbr) {
66027
+ var _a, _b;
66028
+ const t2 = abbr.trim();
66029
+ if (!t2)
66030
+ return false;
66031
+ const mark = /\p{Quotation_Mark}/u;
66032
+ return mark.test((_a = t2[0]) !== null && _a !== void 0 ? _a : "") || mark.test((_b = t2[t2.length - 1]) !== null && _b !== void 0 ? _b : "");
66033
+ }
65962
66034
  function exploreAbbrPossibilities(letter, possibilities) {
65963
66035
  const newPossibilities = [];
65964
66036
  possibilities.forEach(({ prev, next }) => {
@@ -65988,7 +66060,7 @@ function abbreviationsFromText(text) {
65988
66060
  textList.forEach((word, index2) => {
65989
66061
  var _a;
65990
66062
  const abbr = (_a = word.match(/^\(([^\s]{2,})\).{0,1}/)) === null || _a === void 0 ? void 0 : _a[1];
65991
- if (!abbr)
66063
+ if (!abbr || isQuotedParentheticalLabel(abbr) || doi.validate(abbr.trim()) || isUrl(abbr.trim()))
65992
66064
  return;
65993
66065
  const possibleWords = [];
65994
66066
  let wordIndex = index2 - 1;
@@ -66117,8 +66189,11 @@ var handlers = {
66117
66189
  // },
66118
66190
  // code(node, state) {
66119
66191
  // const { lang } = node as Code;
66120
- // state.renderInline(node, 'code', { language: lang });
66192
+ // state.renderInline(node, 'code', { lang });
66121
66193
  // },
66194
+ preformat(node, state2) {
66195
+ state2.addLeaf("code", { value: toTextPreserveWhitespace(node), lang: "text" });
66196
+ },
66122
66197
  list(node, state2) {
66123
66198
  state2.renderInline(node, "list", {
66124
66199
  ordered: node["list-type"] === "ordered"
@@ -66249,6 +66324,10 @@ var handlers = {
66249
66324
  const link = node === null || node === void 0 ? void 0 : node["xlink:href"];
66250
66325
  state2.addLeaf("image", { url: link });
66251
66326
  },
66327
+ ["inline-graphic"](node, state2) {
66328
+ const link = node === null || node === void 0 ? void 0 : node["xlink:href"];
66329
+ state2.addLeaf("image", { url: link });
66330
+ },
66252
66331
  fig(node, state2) {
66253
66332
  var _a;
66254
66333
  const caption = select3("caption", node);
@@ -66726,15 +66805,15 @@ async function jatsConvert(session, input, opts) {
66726
66805
  const logJson = import_node_path10.default.join(dir, `${basename}.log.json`);
66727
66806
  const logYml = import_node_path10.default.join(dir, `${basename}.log.yml`);
66728
66807
  import_node_fs11.default.writeFileSync(logJson, JSON.stringify(logInfo, null, 2));
66729
- import_node_fs11.default.writeFileSync(logYml, js_yaml_default.dump(logInfo));
66808
+ import_node_fs11.default.writeFileSync(logYml, dump(logInfo));
66730
66809
  if ((opts === null || opts === void 0 ? void 0 : opts.frontmatter) === "page") {
66731
66810
  import_node_fs11.default.writeFileSync(mystJson, JSON.stringify({ mdast: tree, frontmatter }, null, 2));
66732
66811
  } else if ((opts === null || opts === void 0 ? void 0 : opts.frontmatter) === "project") {
66733
66812
  if (import_node_fs11.default.existsSync(mystYml)) {
66734
- const previous = js_yaml_default.load(import_node_fs11.default.readFileSync(mystYml).toString());
66735
- import_node_fs11.default.writeFileSync(mystYml, js_yaml_default.dump({ ...previous, project: { ...previous.project, ...frontmatter } }));
66813
+ const previous = load(import_node_fs11.default.readFileSync(mystYml).toString());
66814
+ import_node_fs11.default.writeFileSync(mystYml, dump({ ...previous, project: { ...previous.project, ...frontmatter } }));
66736
66815
  } else {
66737
- import_node_fs11.default.writeFileSync(mystYml, js_yaml_default.dump({ version: 1, project: frontmatter, site: {} }));
66816
+ import_node_fs11.default.writeFileSync(mystYml, dump({ version: 1, project: frontmatter, site: {} }));
66738
66817
  }
66739
66818
  import_node_fs11.default.writeFileSync(mystJson, JSON.stringify({ mdast: tree, frontmatter: { title: frontmatter.title } }, null, 2));
66740
66819
  } else {
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const version = "1.1.0";
1
+ declare const version = "1.1.1";
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.1.0';
1
+ const version = '1.1.1';
2
2
  export default version;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "jats-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Typescript CLI for with JATS",
5
- "author": "Rowan Cockett <rowan@continuous.foundation>",
5
+ "author": "Rowan Cockett <rowan@continuousfoundation.org>",
6
6
  "homepage": "https://github.com/continuous-foundation/jats",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -45,11 +45,11 @@
45
45
  "dependencies": {
46
46
  "doi-utils": "^2.0.6",
47
47
  "fair-principles": "^2.0.0",
48
- "jats-convert": "^1.1.0",
49
- "jats-fetch": "^1.1.0",
50
- "jats-tags": "^1.1.0",
51
- "jats-utils": "^1.1.0",
52
- "jats-xml": "^1.1.0",
48
+ "jats-convert": "^1.1.1",
49
+ "jats-fetch": "^1.1.1",
50
+ "jats-tags": "^1.1.1",
51
+ "jats-utils": "^1.1.1",
52
+ "jats-xml": "^1.1.1",
53
53
  "js-yaml": "^4.1.0",
54
54
  "unist-util-is": "^5.2.1",
55
55
  "unist-util-select": "^4.0.0"