jats-utils 1.1.3 → 1.1.5
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/utils.d.ts.map +1 -1
- package/dist/utils.js +7 -2
- package/package.json +2 -2
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,MAAM,MAAM,qBAAqB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,GAAG,CAAC,EAAE,qBAAqB,GAC1B,WAAW,GAAG,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,MAAM,MAAM,qBAAqB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,GAAG,CAAC,EAAE,qBAAqB,GAC1B,WAAW,GAAG,aAAa,GAAG,SAAS,CAuDzC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAyBvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AA6BD,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAa7D;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,sBAGrC"}
|
package/dist/utils.js
CHANGED
|
@@ -8,9 +8,12 @@ export function convertToUnist(node, ctx) {
|
|
|
8
8
|
const { name, attributes, elements } = node;
|
|
9
9
|
const nextInside = insidePreformat || name === 'preformat';
|
|
10
10
|
const children = elements === null || elements === void 0 ? void 0 : elements.map((el) => convertToUnist(el, { insidePreformat: nextInside })).filter((n) => !!n);
|
|
11
|
-
const { type, ...attrs } = attributes !== null && attributes !== void 0 ? attributes : {};
|
|
11
|
+
const { type, position, ...attrs } = attributes !== null && attributes !== void 0 ? attributes : {};
|
|
12
12
|
if (type !== undefined)
|
|
13
13
|
attrs._type = type;
|
|
14
|
+
// JATS layout position (e.g. float, anchor) must not use `position` — that is reserved for source locations in mdast.
|
|
15
|
+
if (position !== undefined)
|
|
16
|
+
attrs._position = position;
|
|
14
17
|
const next = { type: name !== null && name !== void 0 ? name : 'unknown', ...attrs };
|
|
15
18
|
if (name === 'code') {
|
|
16
19
|
next.value = elements === null || elements === void 0 ? void 0 : elements[0].text;
|
|
@@ -75,9 +78,11 @@ export function convertToXml(node) {
|
|
|
75
78
|
return { type: 'cdata', attributes, cdata };
|
|
76
79
|
}
|
|
77
80
|
default: {
|
|
78
|
-
const { children, _type, ...attributes } = rest;
|
|
81
|
+
const { children, _type, _position, ...attributes } = rest;
|
|
79
82
|
if (_type !== undefined)
|
|
80
83
|
attributes.type = _type;
|
|
84
|
+
if (_position !== undefined)
|
|
85
|
+
attributes.position = _position;
|
|
81
86
|
return { type: 'element', name: type, attributes, elements: children === null || children === void 0 ? void 0 : children.map(convertToXml) };
|
|
82
87
|
}
|
|
83
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jats-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Utility functions for working with JATS in Typescript",
|
|
5
5
|
"author": "Rowan Cockett <rowan@continuousfoundation.org>",
|
|
6
6
|
"homepage": "https://github.com/continuous-foundation/jats",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"unist-util-select": "^4.0.0",
|
|
39
|
-
"jats-tags": "^1.1.
|
|
39
|
+
"jats-tags": "^1.1.5"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"xml-js": "^1"
|