@ndla/article-converter 6.0.41 → 6.0.43

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.
Files changed (147) hide show
  1. package/es/extractEmbedMeta.js +8 -8
  2. package/es/index.js +2 -2
  3. package/es/plugins/anchorPlugin.js +3 -3
  4. package/es/plugins/asidePlugin.js +4 -4
  5. package/es/plugins/copyParagraphPlugin.js +4 -4
  6. package/es/plugins/ddPlugin.js +2 -2
  7. package/es/plugins/divPlugin.js +14 -14
  8. package/es/plugins/dtPlugin.js +2 -2
  9. package/es/plugins/embed/KeyFigureEmbedPlugin.js +5 -5
  10. package/es/plugins/embed/audioEmbedPlugin.js +3 -3
  11. package/es/plugins/embed/blogPostEmbedPlugin.js +5 -5
  12. package/es/plugins/embed/brightcoveEmbedPlugin.js +3 -3
  13. package/es/plugins/embed/campaignBlockPlugin.js +5 -5
  14. package/es/plugins/embed/codeEmbedPlugin.js +3 -3
  15. package/es/plugins/embed/conceptEmbedPlugin.js +3 -3
  16. package/es/plugins/embed/conceptListEmbedPlugin.js +3 -3
  17. package/es/plugins/embed/contactBlockEmbedPlugin.js +4 -4
  18. package/es/plugins/embed/contentLinkEmbedPlugin.js +3 -3
  19. package/es/plugins/embed/externalEmbedPlugin.js +3 -3
  20. package/es/plugins/embed/fileEmbedPlugin.js +5 -5
  21. package/es/plugins/embed/footnoteEmbedPlugin.js +3 -3
  22. package/es/plugins/embed/h5pEmbedPlugin.js +3 -3
  23. package/es/plugins/embed/iframeEmbedPlugin.js +3 -3
  24. package/es/plugins/embed/imageEmbedPlugin.js +4 -4
  25. package/es/plugins/embed/index.js +27 -27
  26. package/es/plugins/embed/linkBlockEmbedPlugin.js +3 -3
  27. package/es/plugins/embed/relatedContentEmbedPlugin.js +3 -3
  28. package/es/plugins/h3Plugin.js +1 -1
  29. package/es/plugins/index.js +15 -15
  30. package/es/plugins/mathPlugin.js +2 -2
  31. package/es/plugins/navPlugin.js +3 -3
  32. package/es/plugins/oembed/anchorPlugin.js +3 -3
  33. package/es/plugins/olPlugin.js +5 -5
  34. package/es/plugins/paragraphPlugin.js +3 -3
  35. package/es/plugins/spanPlugin.js +3 -3
  36. package/es/plugins/tablePlugin.js +2 -2
  37. package/es/plugins/ulPlugin.js +3 -3
  38. package/es/transform.js +9 -9
  39. package/lib/extractEmbedMeta.d.ts +1 -1
  40. package/lib/extractEmbedMeta.js +7 -7
  41. package/lib/index.d.ts +3 -3
  42. package/lib/plugins/anchorPlugin.d.ts +1 -1
  43. package/lib/plugins/asidePlugin.d.ts +1 -1
  44. package/lib/plugins/asidePlugin.js +2 -2
  45. package/lib/plugins/copyParagraphPlugin.d.ts +1 -1
  46. package/lib/plugins/copyParagraphPlugin.js +2 -2
  47. package/lib/plugins/ddPlugin.d.ts +1 -1
  48. package/lib/plugins/divPlugin.d.ts +1 -1
  49. package/lib/plugins/divPlugin.js +11 -11
  50. package/lib/plugins/dtPlugin.d.ts +1 -1
  51. package/lib/plugins/embed/KeyFigureEmbedPlugin.d.ts +1 -1
  52. package/lib/plugins/embed/KeyFigureEmbedPlugin.js +3 -3
  53. package/lib/plugins/embed/audioEmbedPlugin.d.ts +1 -1
  54. package/lib/plugins/embed/audioEmbedPlugin.js +1 -1
  55. package/lib/plugins/embed/blogPostEmbedPlugin.d.ts +1 -1
  56. package/lib/plugins/embed/blogPostEmbedPlugin.js +3 -3
  57. package/lib/plugins/embed/brightcoveEmbedPlugin.d.ts +1 -1
  58. package/lib/plugins/embed/brightcoveEmbedPlugin.js +1 -1
  59. package/lib/plugins/embed/campaignBlockPlugin.d.ts +1 -1
  60. package/lib/plugins/embed/campaignBlockPlugin.js +3 -3
  61. package/lib/plugins/embed/codeEmbedPlugin.d.ts +1 -1
  62. package/lib/plugins/embed/codeEmbedPlugin.js +1 -1
  63. package/lib/plugins/embed/conceptEmbedPlugin.d.ts +1 -1
  64. package/lib/plugins/embed/conceptEmbedPlugin.js +1 -1
  65. package/lib/plugins/embed/conceptListEmbedPlugin.d.ts +1 -1
  66. package/lib/plugins/embed/conceptListEmbedPlugin.js +1 -1
  67. package/lib/plugins/embed/contactBlockEmbedPlugin.d.ts +1 -1
  68. package/lib/plugins/embed/contactBlockEmbedPlugin.js +2 -2
  69. package/lib/plugins/embed/contentLinkEmbedPlugin.d.ts +1 -1
  70. package/lib/plugins/embed/contentLinkEmbedPlugin.js +1 -1
  71. package/lib/plugins/embed/externalEmbedPlugin.d.ts +1 -1
  72. package/lib/plugins/embed/externalEmbedPlugin.js +1 -1
  73. package/lib/plugins/embed/fileEmbedPlugin.d.ts +1 -1
  74. package/lib/plugins/embed/fileEmbedPlugin.js +3 -3
  75. package/lib/plugins/embed/footnoteEmbedPlugin.d.ts +1 -1
  76. package/lib/plugins/embed/footnoteEmbedPlugin.js +1 -1
  77. package/lib/plugins/embed/h5pEmbedPlugin.d.ts +1 -1
  78. package/lib/plugins/embed/h5pEmbedPlugin.js +1 -1
  79. package/lib/plugins/embed/iframeEmbedPlugin.d.ts +1 -1
  80. package/lib/plugins/embed/iframeEmbedPlugin.js +1 -1
  81. package/lib/plugins/embed/imageEmbedPlugin.d.ts +1 -1
  82. package/lib/plugins/embed/imageEmbedPlugin.js +2 -2
  83. package/lib/plugins/embed/index.d.ts +1 -1
  84. package/lib/plugins/embed/index.js +9 -9
  85. package/lib/plugins/embed/linkBlockEmbedPlugin.d.ts +1 -1
  86. package/lib/plugins/embed/linkBlockEmbedPlugin.js +1 -1
  87. package/lib/plugins/embed/relatedContentEmbedPlugin.d.ts +1 -1
  88. package/lib/plugins/embed/relatedContentEmbedPlugin.js +1 -1
  89. package/lib/plugins/h3Plugin.d.ts +1 -1
  90. package/lib/plugins/index.d.ts +1 -1
  91. package/lib/plugins/mathPlugin.d.ts +1 -1
  92. package/lib/plugins/mathPlugin.js +1 -1
  93. package/lib/plugins/navPlugin.d.ts +1 -1
  94. package/lib/plugins/navPlugin.js +1 -1
  95. package/lib/plugins/oembed/anchorPlugin.d.ts +1 -1
  96. package/lib/plugins/olPlugin.d.ts +1 -1
  97. package/lib/plugins/olPlugin.js +3 -3
  98. package/lib/plugins/paragraphPlugin.d.ts +1 -1
  99. package/lib/plugins/paragraphPlugin.js +2 -2
  100. package/lib/plugins/spanPlugin.d.ts +1 -1
  101. package/lib/plugins/spanPlugin.js +2 -2
  102. package/lib/plugins/tablePlugin.d.ts +1 -1
  103. package/lib/plugins/types.d.ts +2 -2
  104. package/lib/plugins/ulPlugin.d.ts +1 -1
  105. package/lib/plugins/ulPlugin.js +1 -1
  106. package/lib/transform.d.ts +1 -1
  107. package/lib/transform.js +5 -5
  108. package/package.json +5 -5
  109. package/src/extractEmbedMeta.ts +9 -9
  110. package/src/index.ts +3 -3
  111. package/src/plugins/anchorPlugin.tsx +4 -4
  112. package/src/plugins/asidePlugin.tsx +5 -5
  113. package/src/plugins/copyParagraphPlugin.tsx +5 -5
  114. package/src/plugins/ddPlugin.tsx +3 -3
  115. package/src/plugins/divPlugin.tsx +15 -15
  116. package/src/plugins/dtPlugin.tsx +3 -3
  117. package/src/plugins/embed/KeyFigureEmbedPlugin.tsx +7 -7
  118. package/src/plugins/embed/audioEmbedPlugin.tsx +5 -5
  119. package/src/plugins/embed/blogPostEmbedPlugin.tsx +7 -7
  120. package/src/plugins/embed/brightcoveEmbedPlugin.tsx +5 -5
  121. package/src/plugins/embed/campaignBlockPlugin.tsx +11 -8
  122. package/src/plugins/embed/codeEmbedPlugin.tsx +5 -5
  123. package/src/plugins/embed/conceptEmbedPlugin.tsx +5 -5
  124. package/src/plugins/embed/conceptListEmbedPlugin.tsx +5 -5
  125. package/src/plugins/embed/contactBlockEmbedPlugin.tsx +6 -6
  126. package/src/plugins/embed/contentLinkEmbedPlugin.tsx +5 -5
  127. package/src/plugins/embed/externalEmbedPlugin.tsx +5 -5
  128. package/src/plugins/embed/fileEmbedPlugin.tsx +7 -7
  129. package/src/plugins/embed/footnoteEmbedPlugin.tsx +5 -5
  130. package/src/plugins/embed/h5pEmbedPlugin.tsx +5 -5
  131. package/src/plugins/embed/iframeEmbedPlugin.tsx +5 -5
  132. package/src/plugins/embed/imageEmbedPlugin.tsx +6 -6
  133. package/src/plugins/embed/index.ts +28 -28
  134. package/src/plugins/embed/linkBlockEmbedPlugin.tsx +5 -5
  135. package/src/plugins/embed/relatedContentEmbedPlugin.tsx +5 -5
  136. package/src/plugins/h3Plugin.tsx +2 -2
  137. package/src/plugins/index.ts +16 -16
  138. package/src/plugins/mathPlugin.tsx +3 -3
  139. package/src/plugins/navPlugin.tsx +4 -4
  140. package/src/plugins/oembed/anchorPlugin.tsx +4 -4
  141. package/src/plugins/olPlugin.tsx +6 -6
  142. package/src/plugins/paragraphPlugin.tsx +4 -4
  143. package/src/plugins/spanPlugin.tsx +4 -4
  144. package/src/plugins/tablePlugin.tsx +3 -3
  145. package/src/plugins/types.ts +2 -2
  146. package/src/plugins/ulPlugin.tsx +5 -5
  147. package/src/transform.tsx +11 -11
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const contentLinkEmbedPlugin: PluginType;
@@ -20,7 +20,7 @@ const contentLinkEmbedPlugin = (element, _, _ref) => {
20
20
  isOembed
21
21
  } = _ref;
22
22
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
23
- const data = JSON.parse(props['data-json']);
23
+ const data = JSON.parse(props["data-json"]);
24
24
  return (0, _jsxRuntime.jsx)(_ui.ContentLinkEmbed, {
25
25
  embed: data,
26
26
  isOembed: isOembed
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const externalEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const externalEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.ExternalEmbed, {
22
22
  embed: data
23
23
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const fileEmbedPlugin: PluginType;
@@ -17,14 +17,14 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const fileEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  const {
22
22
  type,
23
23
  title,
24
24
  url,
25
25
  display
26
26
  } = data.embedData;
27
- if (type === 'pdf' && display === 'block') {
27
+ if (type === "pdf" && display === "block") {
28
28
  return (0, _jsxRuntime.jsx)(_ui.PdfFile, {
29
29
  title: title,
30
30
  url: url
@@ -33,7 +33,7 @@ const fileEmbedPlugin = element => {
33
33
  return (0, _jsxRuntime.jsx)(_ui.File, {
34
34
  url: url,
35
35
  title: title,
36
- fileExists: data.status === 'success' ? !!data.data.exists : false,
36
+ fileExists: data.status === "success" ? !!data.data.exists : false,
37
37
  fileType: type
38
38
  });
39
39
  }
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const footnoteEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const footnoteEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.FootnoteEmbed, {
22
22
  embed: data
23
23
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const h5pEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const h5pEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.H5pEmbed, {
22
22
  embed: data
23
23
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const iframeEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const iframeEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.IframeEmbed, {
22
22
  embed: data
23
23
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const imageEmbedPlugin: PluginType;
@@ -17,8 +17,8 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const imageEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
21
- const inGrid = element.parentNode?.parentNode?.attribs?.['data-type'] === 'grid';
20
+ const data = JSON.parse(props["data-json"]);
21
+ const inGrid = element.parentNode?.parentNode?.attribs?.["data-type"] === "grid";
22
22
  return (0, _jsxRuntime.jsx)(_ui.ImageEmbed, {
23
23
  inGrid: inGrid,
24
24
  embed: data,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const embedPlugins: Record<string, PluginType>;
@@ -34,19 +34,19 @@ const embedPlugins = exports.embedPlugins = {
34
34
  image: _imageEmbedPlugin.imageEmbedPlugin,
35
35
  audio: _audioEmbedPlugin.audioEmbedPlugin,
36
36
  h5p: _h5pEmbedPlugin.h5pEmbedPlugin,
37
- 'code-block': _codeEmbedPlugin.codeEmbedPlugin,
37
+ "code-block": _codeEmbedPlugin.codeEmbedPlugin,
38
38
  external: _externalEmbedPlugin.externalEmbedPlugin,
39
39
  iframe: _iframeEmbedPlugin.iframeEmbedPlugin,
40
40
  footnote: _footnoteEmbedPlugin.footnoteEmbedPlugin,
41
41
  brightcove: _brightcoveEmbedPlugin.brightcoveEmbedPlugin,
42
- 'related-content': _relatedContentEmbedPlugin.relatedContentEmbedPlugin,
43
- 'content-link': _contentLinkEmbedPlugin.contentLinkEmbedPlugin,
42
+ "related-content": _relatedContentEmbedPlugin.relatedContentEmbedPlugin,
43
+ "content-link": _contentLinkEmbedPlugin.contentLinkEmbedPlugin,
44
44
  concept: _conceptEmbedPlugin.conceptEmbedPlugin,
45
- 'concept-list': _conceptListEmbedPlugin.conceptListEmbedPlugin,
46
- 'blog-post': _blogPostEmbedPlugin.blogPostEmbedPlugin,
45
+ "concept-list": _conceptListEmbedPlugin.conceptListEmbedPlugin,
46
+ "blog-post": _blogPostEmbedPlugin.blogPostEmbedPlugin,
47
47
  file: _fileEmbedPlugin.fileEmbedPlugin,
48
- 'key-figure': _KeyFigureEmbedPlugin.keyFigureEmbedPlugin,
49
- 'contact-block': _contactBlockEmbedPlugin.contactBlockEmbedPlugin,
50
- 'campaign-block': _campaignBlockPlugin.campaignBlockPlugin,
51
- 'link-block': _linkBlockEmbedPlugin.linkBlockPlugin
48
+ "key-figure": _KeyFigureEmbedPlugin.keyFigureEmbedPlugin,
49
+ "contact-block": _contactBlockEmbedPlugin.contactBlockEmbedPlugin,
50
+ "campaign-block": _campaignBlockPlugin.campaignBlockPlugin,
51
+ "link-block": _linkBlockEmbedPlugin.linkBlockPlugin
52
52
  };
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const linkBlockPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const linkBlockPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.LinkBlock, {
22
22
  ...data.embedData,
23
23
  path: opts.path
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const relatedContentEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const relatedContentEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.RelatedContentEmbed, {
22
22
  embed: data,
23
23
  subject: opts.subject,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const h3Plugin: PluginType;
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const basePlugins: Record<string, PluginType>;
10
10
  export declare const oembedPlugins: Record<string, PluginType>;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const mathPlugin: PluginType;
@@ -16,7 +16,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
 
17
17
  const mathPlugin = node => {
18
18
  const {
19
- 'data-math': mathContent,
19
+ "data-math": mathContent,
20
20
  ...props
21
21
  } = (0, _htmlReactParser.attributesToProps)(node.attribs);
22
22
  // @ts-ignore
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const navPlugin: PluginType;
@@ -16,7 +16,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const navPlugin = (node, opts) => {
19
- if (node.attribs['data-type'] === 'link-block-list') {
19
+ if (node.attribs["data-type"] === "link-block-list") {
20
20
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
21
21
  return (0, _jsxRuntime.jsx)(_ui.LinkBlockSection, {
22
22
  ...props,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const anchorPlugin: PluginType;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const olPlugin: PluginType;
@@ -17,10 +17,10 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const olPlugin = (node, converterOpts, opts) => {
19
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'];
20
+ const letterClass = node.attribs["data-type"] === "letters" ? "ol-list--roman" : false;
21
+ const num = node.attribs["start"];
22
22
  const numClass = num ? `ol-reset-${num}` : false;
23
- const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(' ');
23
+ const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(" ");
24
24
  return (0, _jsxRuntime.jsx)(_ui.OrderedList, {
25
25
  ...props,
26
26
  className: classes.length ? classes : undefined,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const paragraphPlugin: PluginType;
@@ -16,8 +16,8 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
 
17
17
  const paragraphPlugin = (node, converterOpts, opts) => {
18
18
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
19
- if (node.attribs['data-align'] === 'center') {
20
- const classes = [node.attribs.class ?? '', 'u-text-center'].filter(c => !!c).join(' ');
19
+ if (node.attribs["data-align"] === "center") {
20
+ const classes = [node.attribs.class ?? "", "u-text-center"].filter(c => !!c).join(" ");
21
21
  return (0, _jsxRuntime.jsx)("p", {
22
22
  ...props,
23
23
  lang: opts.articleLanguage,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const spanPlugin: PluginType;
@@ -15,12 +15,12 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
15
  */
16
16
 
17
17
  const spanPlugin = (node, opts) => {
18
- if (node.attribs['data-size'] === 'large') {
18
+ if (node.attribs["data-size"] === "large") {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
20
20
  return (0, _jsxRuntime.jsx)("span", {
21
21
  ...props,
22
22
  "data-size": undefined,
23
- className: `${node.attribs.class ?? ''} u-large-body-text`,
23
+ className: `${node.attribs.class ?? ""} u-large-body-text`,
24
24
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
25
25
  });
26
26
  }
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const tablePlugin: PluginType;
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import { Element, HTMLReactParserOptions } from 'html-react-parser';
10
- import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from '@ndla/ui';
9
+ import { Element, HTMLReactParserOptions } from "html-react-parser";
10
+ import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from "@ndla/ui";
11
11
  export interface DynamicComponents {
12
12
  heartButton?: HeartButtonType;
13
13
  }
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const ulPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const ulPlugin = (node, converterOpts, opts) => {
19
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(' ');
20
+ const classes = [node.attribs.class ?? "", node.attribs["data-type"] === "two-column" ? "o-list--two-columns" : ""].filter(c => !!c).join(" ");
21
21
  return (0, _jsxRuntime.jsx)(_ui.UnOrderedList, {
22
22
  ...props,
23
23
  className: classes,
@@ -6,6 +6,6 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import { TransformOptions } from './plugins/types';
9
+ import { TransformOptions } from "./plugins/types";
10
10
  declare const transform: (content: string, opts: TransformOptions) => string | JSX.Element | JSX.Element[];
11
11
  export default transform;
package/lib/transform.js CHANGED
@@ -22,17 +22,17 @@ const transform = (content, opts) => {
22
22
  const plugins = opts?.isOembed ? _plugins.oembedPlugins : _plugins.basePlugins;
23
23
  const options = {
24
24
  replace: node => {
25
- if (!('attribs' in node)) {
25
+ if (!("attribs" in node)) {
26
26
  return;
27
27
  }
28
28
  if (plugins[node.name]) {
29
29
  return plugins[node.name](node, options, opts);
30
30
  }
31
- if (node.name === 'ndlaembed') {
32
- if (_embed.embedPlugins[node.attribs['data-resource']]) {
33
- return _embed.embedPlugins[node.attribs['data-resource']](node, options, opts);
31
+ if (node.name === "ndlaembed") {
32
+ if (_embed.embedPlugins[node.attribs["data-resource"]]) {
33
+ return _embed.embedPlugins[node.attribs["data-resource"]](node, options, opts);
34
34
  } else {
35
- const embed = JSON.parse(node.attribs['data-json']);
35
+ const embed = JSON.parse(node.attribs["data-json"]);
36
36
  return (0, _jsxRuntime.jsx)(_ui.UnknownEmbed, {
37
37
  embed: embed
38
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "6.0.41",
3
+ "version": "6.0.43",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -28,11 +28,11 @@
28
28
  ],
29
29
  "devDependencies": {
30
30
  "@ndla/types-backend": "^0.2.21",
31
- "@ndla/types-embed": "^4.0.11"
31
+ "@ndla/types-embed": "^4.0.13"
32
32
  },
33
33
  "dependencies": {
34
- "@ndla/code": "^5.0.28",
35
- "@ndla/ui": "^50.7.3",
34
+ "@ndla/code": "^5.0.30",
35
+ "@ndla/ui": "^50.8.1",
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": "c84efb40a39cfa9626d3862c6d4ca1909cee0380"
51
+ "gitHead": "9d844b2508b4268099ea16ef69f14c273c4b4033"
52
52
  }
@@ -6,36 +6,36 @@
6
6
  *
7
7
  */
8
8
 
9
- import parse from 'html-react-parser';
10
- import { EmbedMetaData } from '@ndla/types-embed';
9
+ import parse from "html-react-parser";
10
+ import { EmbedMetaData } from "@ndla/types-embed";
11
11
 
12
12
  const extractEmbedMeta = (embed: string): EmbedMetaData | undefined => {
13
13
  const node = parse(embed);
14
- if (typeof node === 'string' || Array.isArray(node) || node.type !== 'ndlaembed' || !node.props['data-json']) {
14
+ if (typeof node === "string" || Array.isArray(node) || node.type !== "ndlaembed" || !node.props["data-json"]) {
15
15
  return;
16
16
  }
17
17
 
18
- return JSON.parse(node.props['data-json']) as EmbedMetaData;
18
+ return JSON.parse(node.props["data-json"]) as EmbedMetaData;
19
19
  };
20
20
 
21
21
  export const extractEmbedMetas = (embed: string): EmbedMetaData[] => {
22
22
  const nodes = parse(embed);
23
23
 
24
24
  // There are no embeds in the string
25
- if (typeof nodes === 'string') {
25
+ if (typeof nodes === "string") {
26
26
  return [];
27
27
  }
28
28
  // There is only one embed in the string
29
- else if (!Array.isArray(nodes) && nodes.type === 'ndlaembed' && !!nodes.props['data-json']) {
30
- return [JSON.parse(nodes.props['data-json']) as EmbedMetaData];
29
+ else if (!Array.isArray(nodes) && nodes.type === "ndlaembed" && !!nodes.props["data-json"]) {
30
+ return [JSON.parse(nodes.props["data-json"]) as EmbedMetaData];
31
31
  }
32
32
  // There are multiple embeds in the string
33
33
  else if (
34
34
  Array.isArray(nodes) &&
35
35
  nodes.length &&
36
- nodes.every((n) => n.type === 'ndlaembed' && !!n.props['data-json'])
36
+ nodes.every((n) => n.type === "ndlaembed" && !!n.props["data-json"])
37
37
  ) {
38
- return nodes.map((n) => JSON.parse(n.props['data-json']) as EmbedMetaData);
38
+ return nodes.map((n) => JSON.parse(n.props["data-json"]) as EmbedMetaData);
39
39
  } else {
40
40
  return [];
41
41
  }
package/src/index.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  *
7
7
  */
8
8
 
9
- export { default as transform } from './transform';
10
- export { default as extractEmbedMeta, extractEmbedMetas } from './extractEmbedMeta';
11
- export type { TransformOptions, DynamicComponents } from './plugins/types';
9
+ export { default as transform } from "./transform";
10
+ export { default as extractEmbedMeta, extractEmbedMetas } from "./extractEmbedMeta";
11
+ export type { TransformOptions, DynamicComponents } from "./plugins/types";
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import SafeLink from '@ndla/safelink';
11
- import { getPossiblyRelativeUrl } from '@ndla/ui';
12
- import { PluginType } from './types';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import SafeLink from "@ndla/safelink";
11
+ import { getPossiblyRelativeUrl } from "@ndla/ui";
12
+ import { PluginType } from "./types";
13
13
 
14
14
  export const anchorPlugin: PluginType = (node, opts, { path }) => {
15
15
  const props = attributesToProps(node.attribs);
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { domToReact } from 'html-react-parser';
10
- import { Aside, FactBox } from '@ndla/ui';
11
- import { PluginType } from './types';
9
+ import { domToReact } from "html-react-parser";
10
+ import { Aside, FactBox } from "@ndla/ui";
11
+ import { PluginType } from "./types";
12
12
  export const asidePlugin: PluginType = (node, opts) => {
13
- if (node.attribs['data-type'] === 'factAside') {
13
+ if (node.attribs["data-type"] === "factAside") {
14
14
  return <FactBox>{domToReact(node.children, opts)}</FactBox>;
15
- } else if (node.attribs['data-type'] === 'rightAside') {
15
+ } else if (node.attribs["data-type"] === "rightAside") {
16
16
  return (
17
17
  <Aside wideScreen alwaysShow>
18
18
  {domToReact(node.children, opts)}
@@ -6,14 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
- import { Element, domToReact } from 'html-react-parser';
10
- import { CopyParagraphButton } from '@ndla/ui';
11
- import { PluginType } from './types';
9
+ import { Element, domToReact } from "html-react-parser";
10
+ import { CopyParagraphButton } from "@ndla/ui";
11
+ import { PluginType } from "./types";
12
12
  export const copyParagraphPlugin: PluginType = (node, converterOpts, opts) => {
13
13
  const parent = node.parent as Element | undefined;
14
- if (parent?.name === 'section' || (parent?.name === 'div' && Object.keys(parent.attribs ?? {}).length === 0)) {
14
+ if (parent?.name === "section" || (parent?.name === "div" && Object.keys(parent.attribs ?? {}).length === 0)) {
15
15
  return (
16
- <CopyParagraphButton copyText={node.attribs['data-text']} lang={opts.articleLanguage}>
16
+ <CopyParagraphButton copyText={node.attribs["data-text"]} lang={opts.articleLanguage}>
17
17
  {domToReact(node.children, converterOpts)}
18
18
  </CopyParagraphButton>
19
19
  );
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { DefinitionDescription } from '@ndla/ui';
11
- import { PluginType } from './types';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { DefinitionDescription } from "@ndla/ui";
11
+ import { PluginType } from "./types";
12
12
 
13
13
  export const ddPlugin: PluginType = (node, converterOpts, opts) => {
14
14
  const props = attributesToProps(node.attribs);