@ndla/article-converter 6.0.15 → 6.0.16
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/extractEmbedMeta.js +6 -10
- package/es/plugins/anchorPlugin.js +9 -12
- package/es/plugins/asidePlugin.js +1 -1
- package/es/plugins/copyParagraphPlugin.js +3 -4
- package/es/plugins/ddPlugin.js +5 -10
- package/es/plugins/divPlugin.js +16 -34
- package/es/plugins/dtPlugin.js +5 -10
- package/es/plugins/embed/KeyFigureEmbedPlugin.js +8 -7
- package/es/plugins/embed/audioEmbedPlugin.js +4 -5
- package/es/plugins/embed/blogPostEmbedPlugin.js +15 -15
- package/es/plugins/embed/brightcoveEmbedPlugin.js +4 -5
- package/es/plugins/embed/campaignBlockPlugin.js +4 -4
- package/es/plugins/embed/codeEmbedPlugin.js +3 -3
- package/es/plugins/embed/conceptEmbedPlugin.js +4 -5
- package/es/plugins/embed/conceptListEmbedPlugin.js +3 -3
- package/es/plugins/embed/contactBlockEmbedPlugin.js +13 -13
- package/es/plugins/embed/contentLinkEmbedPlugin.js +6 -4
- package/es/plugins/embed/externalEmbedPlugin.js +3 -3
- package/es/plugins/embed/fileEmbedPlugin.js +9 -8
- package/es/plugins/embed/footnoteEmbedPlugin.js +3 -3
- package/es/plugins/embed/h5pEmbedPlugin.js +3 -3
- package/es/plugins/embed/iframeEmbedPlugin.js +3 -3
- package/es/plugins/embed/imageEmbedPlugin.js +6 -7
- package/es/plugins/embed/index.js +1 -1
- package/es/plugins/embed/linkBlockEmbedPlugin.js +6 -11
- package/es/plugins/embed/relatedContentEmbedPlugin.js +3 -3
- package/es/plugins/h3Plugin.js +5 -10
- package/es/plugins/index.js +4 -9
- package/es/plugins/mathPlugin.js +8 -15
- package/es/plugins/navPlugin.js +5 -10
- package/es/plugins/oembed/anchorPlugin.js +9 -12
- package/es/plugins/olPlugin.js +9 -17
- package/es/plugins/paragraphPlugin.js +9 -16
- package/es/plugins/spanPlugin.js +6 -12
- package/es/plugins/tablePlugin.js +5 -10
- package/es/plugins/ulPlugin.js +6 -14
- package/es/transform.js +6 -6
- package/lib/extractEmbedMeta.js +7 -12
- package/lib/index.js +5 -6
- package/lib/plugins/anchorPlugin.js +17 -18
- package/lib/plugins/asidePlugin.js +1 -1
- package/lib/plugins/copyParagraphPlugin.js +3 -4
- package/lib/plugins/ddPlugin.js +13 -16
- package/lib/plugins/divPlugin.js +25 -41
- package/lib/plugins/dtPlugin.js +13 -16
- package/lib/plugins/embed/KeyFigureEmbedPlugin.js +8 -7
- package/lib/plugins/embed/audioEmbedPlugin.js +4 -5
- package/lib/plugins/embed/blogPostEmbedPlugin.js +15 -16
- package/lib/plugins/embed/brightcoveEmbedPlugin.js +4 -5
- package/lib/plugins/embed/campaignBlockPlugin.js +4 -4
- package/lib/plugins/embed/codeEmbedPlugin.js +3 -3
- package/lib/plugins/embed/conceptEmbedPlugin.js +4 -5
- package/lib/plugins/embed/conceptListEmbedPlugin.js +3 -3
- package/lib/plugins/embed/contactBlockEmbedPlugin.js +13 -13
- package/lib/plugins/embed/contentLinkEmbedPlugin.js +6 -4
- package/lib/plugins/embed/externalEmbedPlugin.js +3 -3
- package/lib/plugins/embed/fileEmbedPlugin.js +9 -8
- package/lib/plugins/embed/footnoteEmbedPlugin.js +3 -3
- package/lib/plugins/embed/h5pEmbedPlugin.js +3 -3
- package/lib/plugins/embed/iframeEmbedPlugin.js +3 -3
- package/lib/plugins/embed/imageEmbedPlugin.js +6 -7
- package/lib/plugins/embed/index.js +2 -3
- package/lib/plugins/embed/linkBlockEmbedPlugin.js +14 -17
- package/lib/plugins/embed/relatedContentEmbedPlugin.js +3 -3
- package/lib/plugins/h3Plugin.js +13 -16
- package/lib/plugins/index.js +12 -17
- package/lib/plugins/mathPlugin.js +9 -15
- package/lib/plugins/navPlugin.js +13 -16
- package/lib/plugins/oembed/anchorPlugin.js +17 -18
- package/lib/plugins/olPlugin.js +17 -23
- package/lib/plugins/paragraphPlugin.js +17 -22
- package/lib/plugins/spanPlugin.js +14 -18
- package/lib/plugins/tablePlugin.js +13 -16
- package/lib/plugins/ulPlugin.js +14 -20
- package/lib/transform.js +7 -8
- package/package.json +3 -3
package/lib/plugins/index.js
CHANGED
|
@@ -19,19 +19,15 @@ var _ddPlugin = require("./ddPlugin");
|
|
|
19
19
|
var _dtPlugin = require("./dtPlugin");
|
|
20
20
|
var _navPlugin = require("./navPlugin");
|
|
21
21
|
var _anchorPlugin2 = require("./anchorPlugin");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* LICENSE file in the root directory of this source tree.
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
var basePlugins = {
|
|
22
|
+
/**
|
|
23
|
+
* Copyright (c) 2023-present, NDLA.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const basePlugins = exports.basePlugins = {
|
|
35
31
|
h2: _copyParagraphPlugin.copyParagraphPlugin,
|
|
36
32
|
h3: _h3Plugin.h3Plugin,
|
|
37
33
|
ol: _olPlugin.olPlugin,
|
|
@@ -47,8 +43,7 @@ var basePlugins = {
|
|
|
47
43
|
nav: _navPlugin.navPlugin,
|
|
48
44
|
a: _anchorPlugin2.anchorPlugin
|
|
49
45
|
};
|
|
50
|
-
exports.
|
|
51
|
-
|
|
46
|
+
const oembedPlugins = exports.oembedPlugins = {
|
|
47
|
+
...basePlugins,
|
|
52
48
|
a: _anchorPlugin.anchorPlugin
|
|
53
|
-
}
|
|
54
|
-
exports.oembedPlugins = oembedPlugins;
|
|
49
|
+
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.mathPlugin = void 0;
|
|
8
7
|
var _htmlReactParser = require("html-react-parser");
|
|
9
8
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
-
var _excluded = ["data-math"];
|
|
11
9
|
/**
|
|
12
10
|
* Copyright (c) 2023-present, NDLA.
|
|
13
11
|
*
|
|
@@ -15,22 +13,18 @@ var _excluded = ["data-math"];
|
|
|
15
13
|
* LICENSE file in the root directory of this source tree.
|
|
16
14
|
*
|
|
17
15
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
-
var mathPlugin = function mathPlugin(node) {
|
|
26
|
-
var _attributesToProps = (0, _htmlReactParser.attributesToProps)(node.attribs),
|
|
27
|
-
mathContent = _attributesToProps['data-math'],
|
|
28
|
-
props = _objectWithoutProperties(_attributesToProps, _excluded);
|
|
16
|
+
|
|
17
|
+
const mathPlugin = node => {
|
|
18
|
+
const {
|
|
19
|
+
'data-math': mathContent,
|
|
20
|
+
...props
|
|
21
|
+
} = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
29
22
|
// @ts-ignore
|
|
30
|
-
return (0, _jsxRuntime.jsx)("math",
|
|
23
|
+
return (0, _jsxRuntime.jsx)("math", {
|
|
24
|
+
...props,
|
|
31
25
|
dangerouslySetInnerHTML: {
|
|
32
26
|
__html: mathContent
|
|
33
27
|
}
|
|
34
|
-
})
|
|
28
|
+
});
|
|
35
29
|
};
|
|
36
30
|
exports.mathPlugin = mathPlugin;
|
package/lib/plugins/navPlugin.js
CHANGED
|
@@ -7,24 +7,21 @@ exports.navPlugin = void 0;
|
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
8
|
var _ui = require("@ndla/ui");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
var navPlugin = function navPlugin(node, opts) {
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2023-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const navPlugin = (node, opts) => {
|
|
23
19
|
if (node.attribs['data-type'] === 'link-block-list') {
|
|
24
|
-
|
|
25
|
-
return (0, _jsxRuntime.jsx)(_ui.LinkBlockSection,
|
|
20
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
21
|
+
return (0, _jsxRuntime.jsx)(_ui.LinkBlockSection, {
|
|
22
|
+
...props,
|
|
26
23
|
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
27
|
-
})
|
|
24
|
+
});
|
|
28
25
|
}
|
|
29
26
|
return null;
|
|
30
27
|
};
|
|
@@ -9,27 +9,26 @@ var _ui = require("@ndla/ui");
|
|
|
9
9
|
var _safelink = _interopRequireDefault(require("@ndla/safelink"));
|
|
10
10
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return (0, _jsxRuntime.jsx)(_safelink.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
12
|
+
/**
|
|
13
|
+
* Copyright (c) 2023-present, NDLA.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const anchorPlugin = (node, options, _ref) => {
|
|
21
|
+
let {
|
|
22
|
+
path
|
|
23
|
+
} = _ref;
|
|
24
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
25
|
+
const href = (0, _ui.getPossiblyRelativeUrl)(props.href, path);
|
|
26
|
+
return (0, _jsxRuntime.jsx)(_safelink.default, {
|
|
27
|
+
...props,
|
|
29
28
|
target: "_blank",
|
|
30
29
|
to: href,
|
|
31
30
|
rel: "noreferrer",
|
|
32
31
|
children: (0, _htmlReactParser.domToReact)(node.children, options)
|
|
33
|
-
})
|
|
32
|
+
});
|
|
34
33
|
};
|
|
35
34
|
exports.anchorPlugin = anchorPlugin;
|
package/lib/plugins/olPlugin.js
CHANGED
|
@@ -7,31 +7,25 @@ exports.olPlugin = void 0;
|
|
|
7
7
|
var _ui = require("@ndla/ui");
|
|
8
8
|
var _htmlReactParser = require("html-react-parser");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var num = node.attribs['start'];
|
|
27
|
-
var numClass = num ? "ol-reset-".concat(num) : false;
|
|
28
|
-
var classes = [(_node$attribs$class = node.attribs.class) !== null && _node$attribs$class !== void 0 ? _node$attribs$class : false, letterClass, numClass].filter(function (c) {
|
|
29
|
-
return !!c;
|
|
30
|
-
}).join(' ');
|
|
31
|
-
return (0, _jsxRuntime.jsx)(_ui.OrderedList, _objectSpread(_objectSpread({}, props), {}, {
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2023-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const olPlugin = (node, converterOpts, opts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
const letterClass = node.attribs['data-type'] === 'letters' ? 'ol-list--roman' : false;
|
|
21
|
+
const num = node.attribs['start'];
|
|
22
|
+
const numClass = num ? `ol-reset-${num}` : false;
|
|
23
|
+
const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(' ');
|
|
24
|
+
return (0, _jsxRuntime.jsx)(_ui.OrderedList, {
|
|
25
|
+
...props,
|
|
32
26
|
className: classes.length ? classes : undefined,
|
|
33
27
|
lang: opts.articleLanguage,
|
|
34
28
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
35
|
-
})
|
|
29
|
+
});
|
|
36
30
|
};
|
|
37
31
|
exports.olPlugin = olPlugin;
|
|
@@ -6,35 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.paragraphPlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
8
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var paragraphPlugin = function paragraphPlugin(node, converterOpts, opts) {
|
|
22
|
-
var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2023-present, NDLA.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const paragraphPlugin = (node, converterOpts, opts) => {
|
|
18
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
23
19
|
if (node.attribs['data-align'] === 'center') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}).join(' ');
|
|
28
|
-
return (0, _jsxRuntime.jsx)("p", _objectSpread(_objectSpread({}, props), {}, {
|
|
20
|
+
const classes = [node.attribs.class ?? '', 'u-text-center'].filter(c => !!c).join(' ');
|
|
21
|
+
return (0, _jsxRuntime.jsx)("p", {
|
|
22
|
+
...props,
|
|
29
23
|
lang: opts.articleLanguage,
|
|
30
24
|
"data-align": undefined,
|
|
31
25
|
className: classes,
|
|
32
26
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
33
|
-
})
|
|
27
|
+
});
|
|
34
28
|
}
|
|
35
|
-
return (0, _jsxRuntime.jsx)("p",
|
|
29
|
+
return (0, _jsxRuntime.jsx)("p", {
|
|
30
|
+
...props,
|
|
36
31
|
lang: opts.articleLanguage,
|
|
37
32
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
38
|
-
})
|
|
33
|
+
});
|
|
39
34
|
};
|
|
40
35
|
exports.paragraphPlugin = paragraphPlugin;
|
|
@@ -6,27 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.spanPlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
8
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var spanPlugin = function spanPlugin(node, opts) {
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2023-present, NDLA.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const spanPlugin = (node, opts) => {
|
|
22
18
|
if (node.attribs['data-size'] === 'large') {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
21
|
+
...props,
|
|
26
22
|
"data-size": undefined,
|
|
27
|
-
className:
|
|
23
|
+
className: `${node.attribs.class ?? ''} u-large-body-text`,
|
|
28
24
|
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
29
|
-
})
|
|
25
|
+
});
|
|
30
26
|
}
|
|
31
27
|
return null;
|
|
32
28
|
};
|
|
@@ -7,23 +7,20 @@ exports.tablePlugin = void 0;
|
|
|
7
7
|
var _ui = require("@ndla/ui");
|
|
8
8
|
var _htmlReactParser = require("html-react-parser");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var tablePlugin = function tablePlugin(node, converterOpts, opts) {
|
|
23
|
-
var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
24
|
-
return (0, _jsxRuntime.jsx)(_ui.Table, _objectSpread(_objectSpread({}, props), {}, {
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2023-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const tablePlugin = (node, converterOpts, opts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_ui.Table, {
|
|
21
|
+
...props,
|
|
25
22
|
lang: opts.articleLanguage,
|
|
26
23
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
27
|
-
})
|
|
24
|
+
});
|
|
28
25
|
};
|
|
29
26
|
exports.tablePlugin = tablePlugin;
|
package/lib/plugins/ulPlugin.js
CHANGED
|
@@ -7,28 +7,22 @@ exports.ulPlugin = void 0;
|
|
|
7
7
|
var _ui = require("@ndla/ui");
|
|
8
8
|
var _htmlReactParser = require("html-react-parser");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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), {}, {
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2023-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const ulPlugin = (node, converterOpts, opts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
const classes = [node.attribs.class ?? '', node.attribs['data-type'] === 'two-column' ? 'o-list--two-columns' : ''].filter(c => !!c).join(' ');
|
|
21
|
+
return (0, _jsxRuntime.jsx)(_ui.UnOrderedList, {
|
|
22
|
+
...props,
|
|
29
23
|
className: classes,
|
|
30
24
|
lang: opts.articleLanguage,
|
|
31
25
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
32
|
-
})
|
|
26
|
+
});
|
|
33
27
|
};
|
|
34
28
|
exports.ulPlugin = ulPlugin;
|
package/lib/transform.js
CHANGED
|
@@ -18,10 +18,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
replace:
|
|
21
|
+
const transform = (content, opts) => {
|
|
22
|
+
const plugins = opts?.isOembed ? _plugins.oembedPlugins : _plugins.basePlugins;
|
|
23
|
+
const options = {
|
|
24
|
+
replace: node => {
|
|
25
25
|
if (!('attribs' in node)) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
@@ -32,7 +32,7 @@ var transform = function transform(content, opts) {
|
|
|
32
32
|
if (_embed.embedPlugins[node.attribs['data-resource']]) {
|
|
33
33
|
return _embed.embedPlugins[node.attribs['data-resource']](node, options, opts);
|
|
34
34
|
} else {
|
|
35
|
-
|
|
35
|
+
const embed = JSON.parse(node.attribs['data-json']);
|
|
36
36
|
return (0, _jsxRuntime.jsx)(_ui.UnknownEmbed, {
|
|
37
37
|
embed: embed
|
|
38
38
|
});
|
|
@@ -40,8 +40,7 @@ var transform = function transform(content, opts) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
const replaced = (0, _htmlReactParser.default)(content, options);
|
|
44
44
|
return replaced;
|
|
45
45
|
};
|
|
46
|
-
var _default = transform;
|
|
47
|
-
exports.default = _default;
|
|
46
|
+
var _default = exports.default = transform;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.16",
|
|
4
4
|
"description": "Transforms NDLA articles into extended html versions",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/code": "^5.0.18",
|
|
35
|
-
"@ndla/ui": "^50.1.
|
|
35
|
+
"@ndla/ui": "^50.1.2",
|
|
36
36
|
"html-react-parser": "^4.2.2",
|
|
37
37
|
"lodash": "^4.17.20"
|
|
38
38
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a3aad57d56edabe22d550adb5fda8af5ab6c8b6f"
|
|
52
52
|
}
|