meca 1.0.18 → 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
@@ -151,6 +151,6 @@ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908
151
151
  <p style="text-align: center; color: #aaa; padding-top: 50px">
152
152
  Made with love by
153
153
  <a href="https://continuous.foundation" target="_blank" style="color: #aaa">
154
- Continuous Science Foundation <img src="https://continuous.foundation/images/logo-small.svg" style="height: 1em" />
154
+ Continuous Science Foundation <img src="https://cdn.curvenote.com/static/site/csf/icon.svg" style="height: 1em" />
155
155
  </a>
156
156
  </p>
package/dist/meca.cjs CHANGED
@@ -13042,7 +13042,7 @@ var {
13042
13042
  } = import_index.default;
13043
13043
 
13044
13044
  // src/version.ts
13045
- var version = "1.0.18";
13045
+ var version = "1.1.1";
13046
13046
  var version_default = version;
13047
13047
 
13048
13048
  // ../../node_modules/myst-cli-utils/node_modules/chalk/source/vendor/ansi-styles/index.js
@@ -14161,11 +14161,14 @@ function createState(selector, tree) {
14161
14161
  }
14162
14162
 
14163
14163
  // ../jats-utils/dist/utils.js
14164
- function convertToUnist(node) {
14164
+ function convertToUnist(node, ctx) {
14165
+ var _a;
14166
+ const insidePreformat = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.insidePreformat) !== null && _a !== void 0 ? _a : false;
14165
14167
  switch (node.type) {
14166
14168
  case "element": {
14167
14169
  const { name: name2, attributes, elements } = node;
14168
- const children = elements === null || elements === void 0 ? void 0 : elements.map(convertToUnist).filter((n) => !!n);
14170
+ const nextInside = insidePreformat || name2 === "preformat";
14171
+ const children = elements === null || elements === void 0 ? void 0 : elements.map((el) => convertToUnist(el, { insidePreformat: nextInside })).filter((n) => !!n);
14169
14172
  const { type, ...attrs } = attributes !== null && attributes !== void 0 ? attributes : {};
14170
14173
  if (type !== void 0)
14171
14174
  attrs._type = type;
@@ -14178,18 +14181,24 @@ function convertToUnist(node) {
14178
14181
  }
14179
14182
  case "text": {
14180
14183
  const { attributes, text } = node;
14184
+ const raw = String(text);
14185
+ if (!insidePreformat && !raw.trim()) {
14186
+ return void 0;
14187
+ }
14188
+ const value = insidePreformat ? raw : raw.replace(/\n(\s+)$/, "");
14181
14189
  return {
14182
14190
  type: "text",
14183
14191
  ...attributes,
14184
- value: String(text).replace(/\n(\s+)$/, "")
14192
+ value
14185
14193
  };
14186
14194
  }
14187
14195
  case "cdata": {
14188
14196
  const { attributes, cdata } = node;
14197
+ const str = String(cdata);
14189
14198
  return {
14190
14199
  type: "cdata",
14191
14200
  ...attributes,
14192
- cdata: String(cdata).trim()
14201
+ cdata: insidePreformat ? str : str.trim()
14193
14202
  };
14194
14203
  }
14195
14204
  case "comment": {
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const version = "1.0.18";
1
+ declare const version = "1.1.1";
2
2
  export default version;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,WAAW,CAAC;AACzB,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,UAAU,CAAC;AACxB,eAAe,OAAO,CAAC"}
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- const version = '1.0.18';
1
+ const version = '1.1.1';
2
2
  export default version;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "meca",
3
- "version": "1.0.18",
3
+ "version": "1.1.1",
4
4
  "description": "Types and utilities for working with MECA",
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,8 +45,8 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "adm-zip": "^0.5.10",
48
- "jats-utils": "^1.0.18",
49
- "jats-xml": "^1.0.18",
48
+ "jats-utils": "^1.1.1",
49
+ "jats-xml": "^1.1.1",
50
50
  "node-fetch": "^3.3.1",
51
51
  "unist-util-select": "^4.0.0",
52
52
  "xml-js": "^1.6.11"