@ndla/article-converter 2.0.2 → 2.0.4

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.
@@ -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
- if (node.attribs['data-type'] === 'two-column') {
20
- var _node$attribs$class;
21
- var props = attributesToProps(node.attribs);
22
- var classes = [(_node$attribs$class = node.attribs["class"]) !== null && _node$attribs$class !== void 0 ? _node$attribs$class : '', 'o-list--two-columns'].filter(function (c) {
23
- return !!c;
24
- }).join(' ');
25
- return _jsx(UnOrderedList, _objectSpread(_objectSpread({}, props), {}, {
26
- className: classes,
27
- children: domToReact(node.children, opts)
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
  };
@@ -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
- if (node.attribs['data-type'] === 'two-column') {
24
- var _node$attribs$class;
25
- var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
26
- var classes = [(_node$attribs$class = node.attribs["class"]) !== null && _node$attribs$class !== void 0 ? _node$attribs$class : '', 'o-list--two-columns'].filter(function (c) {
27
- return !!c;
28
- }).join(' ');
29
- return (0, _jsxRuntime.jsx)(_ui.UnOrderedList, _objectSpread(_objectSpread({}, props), {}, {
30
- className: classes,
31
- children: (0, _htmlReactParser.domToReact)(node.children, opts)
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.2",
3
+ "version": "2.0.4",
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.2",
34
+ "@ndla/ui": "^37.0.4",
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": "7ebc236f35b3cd624f5fec74672ef8213d58adae"
47
+ "gitHead": "db2b4d8eda31595ec90f1e2fc26972382214cad9"
48
48
  }
@@ -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
- if (node.attribs['data-type'] === 'two-column') {
14
- const props = attributesToProps(node.attribs);
15
- const classes = [node.attribs.class ?? '', 'o-list--two-columns'].filter((c) => !!c).join(' ');
16
- return (
17
- <UnOrderedList {...props} className={classes}>
18
- {domToReact(node.children, opts)}
19
- </UnOrderedList>
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
  };