@ndla/article-converter 2.0.2 → 2.0.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/es/plugins/ulPlugin.js +9 -12
- package/lib/plugins/ulPlugin.js +9 -12
- package/package.json +3 -3
- package/src/plugins/ulPlugin.tsx +9 -11
package/es/plugins/ulPlugin.js
CHANGED
|
@@ -16,16 +16,13 @@ import { UnOrderedList } from '@ndla/ui';
|
|
|
16
16
|
import { attributesToProps, domToReact } from 'html-react-parser';
|
|
17
17
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
18
18
|
export var ulPlugin = function ulPlugin(node, opts) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
19
|
+
var _node$attribs$class;
|
|
20
|
+
var props = attributesToProps(node.attribs);
|
|
21
|
+
var classes = [(_node$attribs$class = node.attribs["class"]) !== null && _node$attribs$class !== void 0 ? _node$attribs$class : '', node.attribs['data-type'] === 'two-column' ? 'o-list--two-columns' : ''].filter(function (c) {
|
|
22
|
+
return !!c;
|
|
23
|
+
}).join(' ');
|
|
24
|
+
return _jsx(UnOrderedList, _objectSpread(_objectSpread({}, props), {}, {
|
|
25
|
+
className: classes,
|
|
26
|
+
children: domToReact(node.children, opts)
|
|
27
|
+
}));
|
|
31
28
|
};
|
package/lib/plugins/ulPlugin.js
CHANGED
|
@@ -20,17 +20,14 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
22
|
var ulPlugin = function ulPlugin(node, opts) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
23
|
+
var _node$attribs$class;
|
|
24
|
+
var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
25
|
+
var classes = [(_node$attribs$class = node.attribs["class"]) !== null && _node$attribs$class !== void 0 ? _node$attribs$class : '', node.attribs['data-type'] === 'two-column' ? 'o-list--two-columns' : ''].filter(function (c) {
|
|
26
|
+
return !!c;
|
|
27
|
+
}).join(' ');
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_ui.UnOrderedList, _objectSpread(_objectSpread({}, props), {}, {
|
|
29
|
+
className: classes,
|
|
30
|
+
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
31
|
+
}));
|
|
35
32
|
};
|
|
36
33
|
exports.ulPlugin = ulPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Transforms NDLA articles into extended html versions",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ndla/code": "^2.2.1",
|
|
34
|
-
"@ndla/ui": "^37.0.
|
|
34
|
+
"@ndla/ui": "^37.0.5",
|
|
35
35
|
"html-react-parser": "^3.0.8",
|
|
36
36
|
"lodash": "^4.17.20"
|
|
37
37
|
},
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "94f267adcdca7d083503c85cb5721377f5082b21"
|
|
48
48
|
}
|
package/src/plugins/ulPlugin.tsx
CHANGED
|
@@ -10,15 +10,13 @@ import { UnOrderedList } from '@ndla/ui';
|
|
|
10
10
|
import { attributesToProps, domToReact } from 'html-react-parser';
|
|
11
11
|
import { PluginType } from './types';
|
|
12
12
|
export const ulPlugin: PluginType = (node, opts) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return null;
|
|
13
|
+
const props = attributesToProps(node.attribs);
|
|
14
|
+
const classes = [node.attribs.class ?? '', node.attribs['data-type'] === 'two-column' ? 'o-list--two-columns' : '']
|
|
15
|
+
.filter((c) => !!c)
|
|
16
|
+
.join(' ');
|
|
17
|
+
return (
|
|
18
|
+
<UnOrderedList {...props} className={classes}>
|
|
19
|
+
{domToReact(node.children, opts)}
|
|
20
|
+
</UnOrderedList>
|
|
21
|
+
);
|
|
24
22
|
};
|